MHTML
MHTML (MIME HTML) is a format for saving a web page and every resource
it needs — stylesheets, images, scripts, fonts — as a single file, using
the MIME multipart/related structure from email. It is defined in
RFC 2557 (1999). Files end in .mht or .mhtml.
How it works
An MHTML file is literally an email-shaped message:
From: <Saved by Blink>
Subject: Test report
MIME-Version: 1.0
Content-Type: multipart/related; type="text/html"; boundary="----MultipartBoundary--abc"
------MultipartBoundary--abc
Content-Type: text/html
Content-Location: https://example.com/report/
<!DOCTYPE html><html>…<link rel="stylesheet" href="style.css">…
------MultipartBoundary--abc
Content-Type: text/css
Content-Location: https://example.com/report/style.css
body { font-family: system-ui }
Each part carries a Content-Location. When the browser renders the HTML
part and meets style.css, it resolves the URL and serves the matching
part from inside the archive instead of the network. Binary parts are
base64-encoded, which costs about a third more bytes — the same tax as a
data URI.
Who makes it
- Chrome and Edge: Save as → Webpage, Single File (
.mhtml). - Internet Explorer originated it as Web Archive, single file
(
.mht). - Microsoft Word and Excel: Single File Web Page (
.mht) — one reason old intranet reports still arrive in this format. - Safari does not; its single-file format is
.webarchive, a property list that only Safari reads.
Where it fails
MHTML solves "keep it as one file" and then works almost nowhere else:
| Opened from | Result |
|---|---|
| Chrome / Edge, local file, desktop | Renders |
| Firefox | Not supported without an extension |
| Safari | Not supported |
| iPhone or Android | No app renders it |
| Served from a website over HTTPS | Downloaded or refused, not rendered |
| Email attachment preview | Shown as text, or as a download |
The server case is deliberate. An archive can contain parts whose
Content-Location claims any URL, so rendering a downloaded MHTML as if
it were those pages would be a spoofing hole. Chromium only renders MHTML
from a local file.
That rules it out as a way to share a report: you can't host it, phones can't open it, and half of desktop browsers can't either.
The portable alternative: self-contained HTML
The goal MHTML is chasing — one file, nothing missing — is reached more
portably by a self-contained HTML file:
CSS in <style>, scripts in <script>, images and fonts as data: URIs.
It is still ordinary HTML, so every browser on every device opens it, and
it can be served from a URL.
To convert an .mhtml:
- Open it in Chrome or Edge on a desktop.
- Save as → Webpage, Complete. You get
page.htmlpluspage_files/. - Drop both into the free HTML inliner to fold
them into one
.html.
Or skip the file entirely: drop the folder into Comma and send a link that opens on any browser, phone included.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.
Related
- Self-contained HTML · Data URI
- HTML inliner — fold a report folder into one file
- Open an HTML file on Android · on iPhone
- Outlook blocked an HTML attachment