Free HTML sample files
The markup language of web pages. As an upload it needs careful handling because browsers will execute it. Download valid HTML test files in 4 exact sizes, from 1 KB to 1 MB, each with a checksum.
- Extension
- .html
- MIME type
- text/html
- Kind
- Text
- Category
- Documents
HTML files by size
Every file below is a valid HyperText Markup Language file of exactly the stated size. Open a file's page for its checksum and contents, and to preview it in your browser before downloading.
| File | Size | Contents | Download |
|---|---|---|---|
| 1 KB HTML samplesample-html-1kb.html | 1 KB1,024 bytes | Sections: 0 | Download HTML |
| 10 KB HTML samplesample-html-10kb.html | 10 KB10,240 bytes | Sections: 17 | Download HTML |
| 100 KB HTML samplesample-html-100kb.html | 100 KB102,400 bytes | Sections: 181 | Download HTML |
| 1 MB HTML samplesample-html-1mb.html | 1 MB1,048,576 bytes | Sections: 1,865 | Download HTML |
What is an HTML file?
HTML describes the structure of a web page with nested elements such as headings, paragraphs and links. Browsers parse it very forgivingly, following the rules of the WHATWG HTML Living Standard.
An HTML file that a site stores and serves back from its own domain runs with that site's privileges, which is why user-uploaded HTML is a well-known source of cross-site scripting.
How to recognise an HTML file
| Extension | .html |
|---|---|
| MIME type | text/html |
| Standard | HTML Living Standard (WHATWG) |
| Extensions | .html and .htm |
| Encoding | UTF-8, declared with <meta charset> |
| Can contain | Markup, inline CSS, scripts, references to external resources |
What to test for
These are the behaviours that most often go wrong when software handles HTML files.
- Serve uploaded HTML with Content-Disposition: attachment or from a separate domain, and send X-Content-Type-Options: nosniff.
- A text file that merely starts with a tag can be sniffed as HTML by older browsers if the Content-Type header is missing.
Strengths of HTML
- Opens in every browser with no extra software.
- Parsers are extremely forgiving, so imperfect markup still displays.
Limitations of HTML
- A complete page usually depends on separate CSS, script and image files.
- Executes in the browser, so untrusted HTML is a security risk.
Typical uses of HTML test files
- Testing HTML sanitisers and upload filters
- Checking Content-Type and Content-Disposition handling
- Testing scrapers and HTML-to-text conversion
Software that opens HTML
- All web browsers
- Code editors and IDEs
- HTML parsers such as html5lib, jsdom and Beautiful Soup
Specifications
Related
HTML sample files: questions
- Do the HTML samples run any scripts?
- No. They are static documents with one small inline style block, no scripts and no external resources, and they are marked noindex.
- What is the MIME type of an HTML file?
- The MIME type is text/html. The file extension is .html.
- Is a sample HTML file the same as a dummy or example HTML file?
- Yes. Sample, test, dummy and example HTML files are different names for the same thing: an HTML file with known contents that stands in for a real one. Any file on this page will do wherever a tutorial or a test plan asks for a dummy HTML file.