What is the HTML file format?
.html files are used by web browsers for rendering web pages.
.html files store information in plain text format. HTML is a markup language for creating web page content - it defines the structure of simple informational sites as well as the backbone of dynamic web applications. Web browsers use .html files to render websites based on the markup information stored in those files. The HTML source of any page can be viewed from the browser using the View Page Source command, available from the context menu opened by right-clicking on the page.
HTML markup language supports the following constructs:
- markup tags that support properties (attributes),
- data types,
- references,
- entities,
- document type declarations (e.g.
<!DOCTYPE html>).
HTML elements are used to structure the website and add content from external sources, including links to other websites, embedded media, forms and scripts. HTML also supports simple text formatting features such as size, font weight and emphasis. HTML is compatible with CSS styles and supports dynamic content such as video playback or interactive animations through linked JavaScript files.
Files with the .html extension store data in plain text format and can thus be easily edited using any text editor. However, it is recommended that .html files be edited using dedicated code editors to avoid potential errors. Such tools can automatically highlight keywords, correct syntax errors or autofill values. The .html and .htm extensions represent the same format - the shorter variant was a legacy workaround for older operating systems with three-character filename limits.
Security & safety
RISK: LOWAn .html file is plain text and is safe to open in a text editor. The caution is that HTML pages can embed JavaScript, which runs when you open the file in a browser - a malicious local .html could host a phishing page (a fake login form) or run scripts. Treat .html files from e-mail or untrusted downloads like any web page: don't enter credentials into an unexpected page, and open suspicious files in a text editor first to inspect them rather than letting a browser execute them. HTML "attachments" in e-mail are a known phishing technique.
Format details
in a nutshellPrograms that open HTML files
Technical details
deep spec| MIME type | text/html |
| Alternative MIME type | application/xhtml+xml (XHTML variant) |
| Character encoding | UTF-8 (recommended by the HTML standard; declared via `<meta charset>` or HTTP Content-Type header) |
| File signature | No binary magic bytes; files typically begin with `<!DOCTYPE html>` or an `<html>` tag |
| Container | Plain-text markup document |
| Compression | None within the file itself; servers may compress content with gzip or Brotli during transfer |
| Typical file size | A few KB to several hundred KB; images, CSS and scripts are referenced as separate external files |
| Document structure | Nested elements - `<html>` root containing `<head>` (metadata and links) and `<body>` (visible page content) |
| Alternative extension | `.htm` (identical format; the shorter name was a legacy workaround for 8.3 filename limits) |
| Scripting | Dynamic behaviour added via inline `<script>` blocks or externally linked `.js` files |
| Styling | Presentation controlled via linked `.css` files, `<style>` blocks, or inline `style` attributes |
| Semantic elements | HTML5 introduced structural tags: `<article>`, `<section>`, `<nav>`, `<aside>`, `<header>`, `<footer>` |
| Accessibility markup | WAI-ARIA roles and `aria-*` attributes can be embedded directly in HTML elements |
| Mobile viewport | `<meta name="viewport">` tag controls layout scaling on small-screen and mobile devices |
| Standard maintenance | Maintained by WHATWG as a continuously updated Living Standard with no frozen version releases |
| Platform support | Cross-platform; supported on Windows, macOS, Linux, Android and iOS wherever a web browser is present |
| Released | 1991 (first HTML by Tim Berners-Lee); HTML5 from 2014 |
| Latest version | HTML Living Standard (WHATWG, continuously updated) |
| Open standard | Yes · royalty-free |
| Specification | html.spec.whatwg.org |
HTML conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about HTML files.