What is the MHTML file format?
An .mhtml file - also saved with the .mht extension - is a MIME HTML web archive that bundles an entire web page into a single portable document. It packages the page's .html markup together with all its images, stylesheets, and scripts, storing each resource as a separate MIME part within the same file.
The format borrows the same multipart-message structure used by .eml email files. Embedded resources are encoded in Base64 or quoted-printable, allowing binary assets to travel inside a plain-text container. Because there is no binary magic number, an .mhtml file can be opened in any text editor; it begins with email-style headers such as MIME-Version: 1.0, Content-Type: multipart/related; boundary=..., Subject:, and Date:.
Internet Explorer popularized the format through its "Web Archive, single file (.mht)" save option. Today, Google Chrome (since v74), Microsoft Edge (Chromium-based), and Opera all natively support saving pages as .mhtml. Microsoft Word can also open and export documents in this format.
On macOS and iOS, Safari defaults to the .webarchive format instead. Firefox does not natively support saving pages as .mhtml; browser extensions fill the gap. Android browser support remains inconsistent.
- To save a page as
.mhtmlin Chrome or Edge: File → Save Page As → Webpage, Single File - To inspect the raw structure: open in any plain-text editor - all MIME boundaries and headers are readable
Security & safety
RISK: MEDIUMAn .mhtml embeds whatever the original page contained, including JavaScript, which can run when the file is opened in a browser - so treat an MHTML from an untrusted source like any untrusted web page: don't open unexpected ones, and prefer converting to PDF (which strips active script) for safe viewing. MHTML files are also used in phishing: attackers send a saved-page attachment that renders a convincing fake login form locally to dodge URL filters, so be wary of unsolicited .mht/.mhtml attachments asking for credentials. The file itself is inert text on disk; the risk is in what its scripts/forms do once rendered.
Format details
in a nutshellPrograms that open MHTML files
Technical details
deep spec| Container format | MIME multipart/related message - the main HTML document plus all page resources (images, CSS, scripts) embedded as separate MIME parts in a single file |
| File encoding | Plain UTF-8 text; binary resources (images, fonts) are Base64- or quoted-printable-encoded within each MIME part |
| File signature | No binary magic bytes - the file opens with plain-text email-style headers: `MIME-Version: 1.0` followed by `Content-Type: multipart/related` |
| Primary MIME type | `multipart/related`; each embedded sub-resource carries its own MIME type (e.g., `image/jpeg`, `text/css`) |
| Alternate extension | `.mht` - identical format; used by Internet Explorer's "Web Archive, single file" save option and supported by the same applications |
| Size overhead | Base64 encoding of binary assets inflates file size by approximately 33 % compared to the sum of original resource sizes |
| Part boundary | Each embedded resource is delimited by a unique boundary string declared in the top-level `Content-Type: multipart/related; boundary=...` header |
| Browser save support | Google Chrome (v74+), Microsoft Edge (Chromium), and Opera natively save pages as `.mhtml`; Firefox requires a third-party extension |
| Script origin | Scripts inside an `.mhtml` file execute with a `null` origin in Chromium-based browsers; CORS blocks cross-origin network requests the page makes |
| Microsoft Office support | Microsoft Word and Excel can open and save files as `.mhtml`, embedding Office XML markup inside the MIME container |
| Inspectability | Fully human-readable in any plain-text editor - MIME part headers, `Content-Location` URLs, and Base64-encoded data are all visible as text |
| Offline resource handling | Resources captured at save time are embedded; any external URL not fetched during saving is referenced by `Content-Location` only and unavailable offline |
| Charset declaration | The HTML part's encoding is declared in both the MIME `Content-Type` header and the HTML `<meta charset>` tag; UTF-8 is standard |
| macOS/iOS alternative | Apple Safari and iOS WebKit save pages as `.webarchive` (a binary plist format) rather than `.mhtml`, so cross-platform sharing may require conversion |
| Email format relationship | Structurally identical to an email message (RFC 2822); an `.mhtml` file can be renamed `.eml` and opened in many mail clients |
| Released | RFC 2557 (1999); popularized by Internet Explorer's 'Web Archive, single file (.mht)' |
| Open standard | Yes · royalty-free |
| Specification | www.rfc-editor.org |
MHTML conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about MHTML files.