MHTML, short for MIME Encapsulation of Aggregate HTML Documents, is a web page archive format used to combine in a single document the HTML code and its companion resources that are otherwise represented by external links (such as images, Flash animations, Java applets, and audio files). The content of an MHTML file is encoded as if it were an HTML e-mail message, using the MIME type multipart/related.

In practical terms, MHTML allows multiple elements of a web page—including images and other media that would typically be saved in a folder as separate files alongside an HTML document—to be saved altogether as a single MHTML file. It does so by expanding upon methods originally developed to enrich email content.[1]

The first part of the file is an e-mail header. The second part is normally encoded HTML. Subsequent parts are additional resources identified by their original URLs and encoded in base64. This format is sometimes referred to as MHT, after the suffix .mht given to such files by default when created by Microsoft Word, Internet Explorer, or Opera. MHTML is a proposed open standard, circulated in a revised edition in 1999 as RFC 2557.

The .mhtml (Web archive) and .eml (e-mail file) file extensions are interchangeable (the files can be renamed). The first can be sent by e-mail (and displayed by the email client if the html code is basic enough) and an e-mail message can be saved to an OS file and renamed to a Web archive extension.

Some browsers support the MHTML format, either directly or through third-party extensions, but the process for saving a web page along with its resources as an MHTML file is not standardized. Due to this, a web page saved as an MHTML file using one browser may render differently on another.

Support for saving web pages as MHTML files was made available in the Opera 9.0 web browser.[2] From Opera 9.50 through the rest of the Presto-based Opera product line (currently at Opera 12.16 as of 19 July 2013), the default format for saving pages is MHTML. The initial release of the new Webkit/Blink-based Opera (Opera 15) did not support MHTML, but subsequent releases (Opera 16 onwards) do.

MHTML can be enabled by typing "opera://flags#save-page-as-mhtml" at the address bar.

Firefox was for many years, like most browsers, a good way to both create and read .mht and mhtml files. Mozilla Firefox previously required an extension to be installed to read and write MHT files. Two extensions were freely available, Mozilla Archive Format and UnMHT. Both were rendered non-installable with the advent of "Firefox Quantum" version 57. (Also, neither of them ever implemented support for multi-process mode.)

With the advent of "Quantum" (the version 57 update in late 2017) those extensions, which allowed Firefox to read or write mht & mhtml files no longer were compatible with Firefox. As of 2018 none of these extensions have been updated to function with the Quantum style Firefox browser.

Although Firefox did not (as of version 56) include support for MHTML without the use of add-ons, there was source code available for viewing MHTML files within the related Thunderbird project, indicating that future support in Mozilla software such as Firefox could become available without such add-ons. But as of 2018 it appears unlikely, and Firefox can no longer support writing or reading .mht or .mhtml files due to lack of any working extension.

As of version 3.1.1 onwards, Apple Inc.'s Safari web browser still does not natively support the MHTML format. Instead, Safari supports the webarchive format, and the macOS version includes a print-to-PDF feature.

As with most other modern web browsers, support for MHTML files can be added to Safari via various third-party extensions.