HTML MIME Type

Learn what text/html means, how browsers identify HTML documents, which extensions are used, and how Poly supports HTML files.

MIME type details for text/html

In active use
MIME typetext/html
Extensions
.html.htm
First standardized1991
Created byTim Berners-Lee
Browser supportChrome, Edge, Firefox, Opera, Safari
Example applicationsGoogle Chrome, Mozilla Firefox
Poly supportYes. Poly recognizes `.html` files, creates page thumbnails, and indexes their readable source. The `.htm` extension is not inferred automatically.
Indexed by PolyYes. Poly indexes HTML source for exact and semantic search, along with the filename and basic text metadata.
Preview in PolyYes. Poly opens the stored document as a rendered page. A standalone file may look incomplete when its styles, images, or other companion resources are unavailable.
Poly agentYes. The Poly agent can read and reason about the HTML source, including its text, structure, links, and attributes.

What does text/html mean?

The text/html media type identifies a document written in HTML syntax. HTML, or HyperText Markup Language, gives a web page its structure and meaning through elements such as headings, paragraphs, links, forms, images, and scripts. Sending Content-Type: text/html tells a browser to parse the response as an HTML document rather than display it as plain text.1

The common extensions are .html and .htm. There is no unique magic number or required opening byte sequence. A valid document might begin with <!doctype html>, a comment, whitespace, or other permitted content, so a filename or an HTTP Content-Type header is more reliable than looking for one signature.1

<!doctype html> is a declaration that asks browsers to use standards mode. It is useful and expected in modern pages, but it is not a file signature and does not determine the MIME type.

Where did HTML come from?

Tim Berners-Lee created the first web browser and editor in 1990 while working at CERN. He released it with the first web server in 1991 and published the specifications for HTML, HTTP, and web identifiers so others could build compatible tools.2 The IETF published HTML 2.0 as RFC 1866 in November 1995, documenting the language's established practice at the time.3

HTML later moved through W3C recommendations such as HTML 3.2 and HTML 4. Today, the continuously maintained HTML Standard defines both the language authors write and the detailed error-recovery rules browsers use for real-world documents.4

This history explains why HTML parsers are forgiving. Browsers build a document tree even when markup is incomplete or contains common mistakes. That resilience is useful for viewing old pages, but it does not mean malformed markup is portable or correct. Validate important documents and test them in more than one browser.

How to open an HTML file

Chrome, Edge, Firefox, Opera, and Safari all open HTML directly. Double-clicking a local .html file is enough for a self-contained page. A source editor is a better choice when you need to inspect or change the markup.

A small modern document can look like this:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Example page</title>
  </head>
  <body>
    <h1>Hello</h1>
  </body>
</html>

The HTML Standard requires UTF-8 for authored documents. When the encoding is not supplied by transport metadata or a byte-order mark, put <meta charset="utf-8"> entirely within the first 1,024 bytes so the browser can decode the rest consistently.5

If a saved page has missing styling or images, check its relative URLs. An HTML file often depends on neighboring CSS, JavaScript, fonts, images, or network resources that were not saved with it.

Support in Poly

Poly gives HTML files a page-oriented preview while keeping the source useful for search and analysis. You can:

  • Browse with generated page thumbnails and open the file as a rendered page.
  • Search the stored source by exact wording or meaning.
  • Find basic text properties such as its snippet and line count.
  • Ask the Poly agent about page text, elements, links, attributes, and overall structure.

Poly recognizes text/html and infers it from .html filenames. The registered .htm extension is not currently inferred from the filename, so supply the correct media type when importing an .htm file.

The source and the rendered result answer different questions. Source search can find markup, attributes, and text even when a companion resource is missing. The preview shows what the stored page can render in its available context. It is not a full website capture, and the agent reads the file's HTML rather than automatically collecting every linked resource.

Serving HTML over HTTP

For a web response, send the correct media type and UTF-8 encoding:

Content-Type: text/html; charset=utf-8

The file extension does not control an HTTP response. A URL with no extension can still be HTML, while a server can accidentally send an .html file as text/plain. Correct metadata matters because browsers use the supplied type when deciding how to process a resource.1

HTML does not have numbered file-format versions that can be identified from the extension. Older documents sometimes use a doctype associated with HTML 4.01 or XHTML, while modern HTML uses the short <!doctype html> form. Browser processing is defined by the current standard rather than by treating .html as a versioned container.

Is text/html the same as application/xhtml+xml?

No. Both can describe documents using HTML elements, but their parsers have different rules.1

Propertytext/htmlapplication/xhtml+xml
SyntaxHTML syntaxXML syntax with HTML elements
Common extensions.html, .htm.xhtml, .xht
Error handlingDefined recovery for malformed markupXML well-formedness rules apply
Typical useOrdinary websites and saved web pagesXML-based workflows that require XHTML

Changing only the MIME type can change parsing behavior. A document that browsers repair as text/html may fail as XML if tags are mismatched, attributes are malformed, or namespace rules are not satisfied.

Converting HTML to other formats

Choose the output according to what you need to preserve:

  • PDF captures a fixed, shareable rendering. Print from a browser after confirming that styles, fonts, and images have loaded.
  • Plain text or Markdown keeps readable content but usually loses layout, scripts, forms, and much of the document structure.
  • A complete web archive is better when you need the page plus dependent resources. A single .html file does not automatically contain its images, stylesheets, fonts, or fetched data.

Conversion from a dynamic page captures a state, not the entire application. Interactive behavior, authentication, live data, animations, and responsive layouts may not survive in a static export.

Can an HTML file be dangerous?

Yes. HTML can execute scripts, submit forms, redirect the browser, request remote resources, and imitate trusted interfaces. The standard specifically warns about information leakage, credential theft, cross-site scripting, cross-site request forgery, and risks from hosting untrusted content on the same origin as sensitive content.1

Treat an unfamiliar HTML file like an unfamiliar website. Open it in an up-to-date browser or a restricted preview, do not enter credentials, and be cautious if it asks to download a file, grant a permission, or follow a login link.

Even a page without scripts can make network requests through images and other embedded resources. For content you publish, use an appropriate Content Security Policy, keep untrusted uploads on a separate origin, and avoid assuming that filename checks alone prove a file is safe.1

Footnotes

  1. WHATWG. HTML Standard: text/html Media Type Registration. Defines the type, common extensions, lack of a magic number, applications, interoperability, and security considerations. 2 3 4 5 6
  2. Berners-Lee, T. The World Wide Web: A Very Short Personal History. World Wide Web Consortium. Describes the 1990 browser and editor, the 1991 release, and publication of the early HTML, HTTP, and identifier specifications.
  3. Berners-Lee, T., and D. Connolly. RFC 1866: Hypertext Markup Language - 2.0. Internet Engineering Task Force, November 1995.
  4. WHATWG. HTML Standard. The living standard defines HTML syntax, browser processing, elements, APIs, and error recovery.
  5. WHATWG. HTML Standard: Specifying the Document's Character Encoding. Requires UTF-8 for authored documents and describes placement of an in-document encoding declaration.
© Poly Corp. 2026