MIME Types

text/html

The MIME type for HTML documents, the standard markup language for web pages.

What Is This?

The text/html MIME type indicates that the content is an HTML document. When a browser receives text/html, it parses and renders the content as a web page, executing embedded CSS and JavaScript. It is the primary content type of the World Wide Web.

Common Uses

1

Common Use

Serving web pages from web servers

2

Common Use

Email body content in HTML format

3

Common Use

Documentation and help pages

4

Common Use

Server-rendered web applications

Examples

Server Configuration

Serve files with the text/html MIME type:

# Nginx
location ~ \.html$ {
  add_header Content-Type "text/html";
}

# Apache
AddType text/html .html
HTML Usage

Use this MIME type in HTML or HTTP:

Content-Type: text/html

<!-- HTML reference -->
<link rel="preload" href="file.html" as="fetch" crossorigin>

Related Entries

More from this reference:

Frequently Asked Questions

What is the difference between text/html and application/xhtml+xml?

text/html is the standard for HTML documents and is more forgiving of syntax errors. application/xhtml+xml requires strict XML parsing and will fail on malformed markup. Most websites use text/html.

Should I use text/html or text/plain for HTML?

Always use text/html. Using text/plain will cause the browser to display the HTML source code as plain text instead of rendering the page.