ArticleslgStudy

computer science

MHTML

MHTML is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand MHTML rather than just read about it. In short: MHTML, an initialism of "MIME encapsulation of aggregate HTML documents", is a web archiving file format used to combine, in a single computer file, the HTML code and its companion resources (such as images) that are represented by external hyperlinks in the web page's HTML code. The content of an MHTML file is encoded using the same techniques that were first developed for HTML email messages, using the MIME conten…

Key takeaways

  • MHTML belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect MHTML to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of MHTML from memory before moving on to harder problems.

Reference excerpt

MHTML, an initialism of "MIME encapsulation of aggregate HTML documents", is a web archiving file format used to combine, in a single computer file, the HTML code and its companion resources (such as images) that are represented by external hyperlinks in the web page's HTML code. The content of an MHTML file is encoded using the same techniques that were first developed for HTML email messages, using the MIME content type multipart/related. MHTML files use an .mhtml or .mht filename extension. The first part of the file is an e-mail header. The second part is normally HTML code. Subsequent parts are additional resources identified by their original uniform resource locators (URLs) and encoded in Base64 binary-to-text encoding. MHTML was proposed as an open standard, then circulated in a revised edition in 1999 as RFC 2557. The .mhtml and .eml filename extensions are interchangeable: either filename extension can be changed from one to the other. An .eml message can be sent by e-mail, and it can be displayed by an email client. An email message can be saved using a .mhtml or .mht filename extension and then opened for display in a web browser or for editing other programs, including word processors and text editors.

Layout The header of an MHTML file contains metadata such as a date and time stamp, page title, the source URL, and a unique randomized boundary string for separating resources contained within the file. The boundary string is defined at the beginning and used throughout the file.

Then, the page resources are contained sequentially, starting with the page's rendered HTML source code. Each resource has its own metadata header which specifies its MIME type and the original location.

The MHTML file ends with a boundary string that is not followed by any data.

MIME type MIME type for MHTML is not well agreed upon. Used MIME types include:

multipart/related application/x-mimearchive message/rfc822

Supporting apps

Web browsers Some browsers support the MHTML format, either directly or through third-party browser extension.

Firefox does not support MHTML. Until version 57 ("Firefox Quantum"), two browser extensions, Mozilla Archive Format or UnMHT, could read and write MHTML files. These extensions are incompatible with version 57 and later. GNOME Web added support for read and save web pages in MHTML since version 3.14.1 released in September 2014. Google Chrome 86 and later can create MHTML files. Internet Explorer 5 was the first browser to support reading and saving web pages and external resources to a single MHTML file. Konqueror 3.5.7 and later terminated support for MHTML files. An extension project, mhtconv, can be used to allow saving and viewing of MHTML files. Microsoft Edge, after switching to the Chromium source code, supports saving web pages as MHTML. NetFront 3.4 (on devices such as the Sony Ericsson K850) can view and save MHTML files. Opera: Support for saving web pages as MHTML files was made available in the Opera 9.0 web browser. From Opera 9.50 through the rest of the Presto-based Opera product line (version 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 (version 15) did not support MHTML, but subsequent releases (16 and later) do. MHTML can be enabled by typing "opera://flags#save-page-as-mhtml" at the address bar. Pale Moon requires an extension to be installed to read and write MHT files. One extension is freely available, MozArchiver, a fork of Mozilla Archive Format extension. Safari 3.1.1 and later terminated native support for the MHTML format. Instead, the browser supports the Web Archive format. 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. Vivaldi 2.3 and later can create MHTML files. It supports both reading and writing MHTML files by toggling the "vivaldi://flags/#save-page-as-mhtml" option. Yandex Browser 22.7.4.960 (July 2022) and later can create MHTML (multipart/related) files.

Other apps Problem Steps Recorder for Windows can save its output to MHT format. The "Save to Google Drive" extension for Google Chrome can save as MHTML as one of its outputs. Microsoft OneNote 2010 and later can email individual pages as .mht files. Evernote for Windows can export notes as MHT format, as an alternative to HTML or its own native .enex format.

Exploits In May 2015, a researcher noted that attackers could build malicious documents by creating an MHT file, appending an MSO object at the end (MSO is a file format used by the Microsoft Outlook e-mail application), and renaming the resulting file with a .doc extension. The delivery method would be by spam emails. In April 2019, a security researcher published details about an XML external entity (XXE) vulnerability that could be exploited when a user opens an MHT file. Since the Windows operating system is set to automatically open all MHT files, by default, in Internet Explorer, the exploit could be triggered when a user double-clicked on a file that they received via email, instant messaging, or another vector, including a different browser.

Alternatives

Self-contained HTML files Contemporary HTML files support storing images, style-sheets and scripts in-line using the data URI scheme. Like the embedded content within MHTML, data URIs use Base64 encoding of the external resources. All modern web browsers can open self-contained HTML files. However, As of February 2026, creating self-contained HTML pages requires browser extensions (such as SingleFile) or third-party app (such as pandoc).

Mozilla Archive Format The Mozilla Archive Format (MAFF) is a legacy Web archive file format that was supported by Firefox from 2004 to 2018 through an add-on. Unlike both MHTML and data URIs, MAFF uses a ZIP container to preserve both the HTML file and its external elements. In October 2017 the add-on developer announced the format would no longer be supported in future versions of Firefox.

See also List of web archiving file formats Data URI scheme Mozilla Archive Format Web Archive format WARC format HTML format MIME type

References

External links MHTML standard explained RFC 2557 (1999)—MIME Encapsulation of Aggregate Documents, such as HTML (MHTML) RFC 2110 (1997, Obsolete)—MIME E-mail Encapsulation of Aggregate Documents, such as HTML (MHTML)

Worked examples

Example 1 — a first encounter with MHTML

Start with the simplest possible case. Write down what MHTML claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to MHTML before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about MHTML ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of MHTML

In research
MHTML appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses MHTML in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
MHTML is common in secondary-school and first-year university syllabi. It links to neighbouring topics Archive formats, Computer-related introductions in 1999, HTML, so understanding it makes those chapters shorter.
In everyday life
Look for MHTML outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “MHTML” →

How to study MHTML in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what MHTML means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain MHTML out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is MHTML in simple terms?

MHTML, an initialism of "MIME encapsulation of aggregate HTML documents", is a web archiving file format used to combine, in a single computer file, the HTML code and its companion resources (such as images) that are represented by external hyperlinks in the web page's HTML code. The content of an…

Why does MHTML matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study MHTML?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on MHTML.

Tags

  • Archive formats
  • Computer-related introductions in 1999
  • HTML
  • Internet Explorer
  • MIME
  • Request for Comments
  • Web archives

Keep exploring