HTML (.html) Test File
text/html
Download Sample File
Free test file, safe content, instant download.
db28eb6695c96e4a733d6637...More Sample HTML Files
Four ready-made HTML fixtures covering the shapes your tools actually meet in production: semantic HTML5, a complete form, nested data tables, and a classic transitional page.
sample.html1.7 KBClassic page — headings, links, lists, inline elements Click to downloadsample-html5.html1.7 KBHTML5 semantic — header/nav/main/article/figure/footer, video & canvas Click to downloadsample-form.html2.2 KBComplete form — 12 input types, select, textarea, fieldset, file upload Click to downloadsample-table.html1.6 KBData tables — caption, thead/tbody/tfoot, scope, nested table Click to downloadWhat is HTML?
HTML (HyperText Markup Language) is the standard markup language for creating web pages and web applications. HTML files define the structure and content of web pages using a system of tags and attributes that describe headings, paragraphs, lists, links, images, forms, and other elements. The latest version, HTML5, introduced semantic elements, multimedia support (audio, video), canvas for drawing, and APIs for geolocation, local storage, and more. HTML files are the building blocks of the World Wide Web, rendered by web browsers to present content to users. They work in conjunction with CSS for styling and JavaScript for interactivity. HTML is maintained by the W3C and WHATWG as a living standard that continues to evolve.
Why Do Developers Need Test HTML Files?
Developers need test HTML files to verify HTML parser functionality, test web scraping tools, validate content management systems, and ensure applications correctly process and render HTML content from various sources.
Common Use Cases
- HTML parser testing
- Web scraper validation
- CMS import testing
- Email template rendering
- Content sanitization testing
How to Test an HTML Parser with These Files
A good HTML fixture should trip the same edge cases as the real web: optional tags, void elements, entities, and deeply nested structures. The fixtures above are hand-written (not minified framework output), so every tag is deliberate and easy to assert against.
Common checks: does the parser reconstruct the DOM correctly around optional closing tags (li, p, tr)? Does it handle void elements (img, input, br) without inventing children? Are entities like © and & decoded? Does document.querySelector find the scoped table headers?
import { readFileSync } from 'node:fs';
import { parse } from 'node-html-parser';
const html = readFileSync('sample-html5.html', 'utf8');
const doc = parse(html);
console.log(doc.querySelector('h1')?.text); // "Sample HTML5 Page"
console.log(doc.querySelectorAll('section').length); // 2
console.log(doc.querySelector('meta[name="description"]')
?.getAttribute('content')); // meta description stringWhich Sample HTML File Should You Use?
| Fixture | Best for | Covers |
|---|---|---|
| sample.html | Quick smoke tests | Basic tags, links, lists, images |
| sample-html5.html | Parsers, scrapers, SEO tools | Semantic elements, meta tags, media, accessibility attributes |
| sample-form.html | Form builders, crawlers, autofill tests | All major input types, validation attributes, select/textarea |
| sample-table.html | Table extraction, data scraping | Caption, header scope, footer, nested tables |
Related Formats
Frequently Asked Questions
- Is this sample HTML file safe to use?
- Yes. All files on SampleFiles are generated programmatically with safe, blank, or sample content. They contain no executable code, macros, or malicious payloads.
- What is the file size?
- Most default sample files are small (under 10KB). Binary test files (.bin) are 1MB, and fonts and media files vary. Use our Custom Generator to create files in specific sizes up to 100MB.
- Can I use these files commercially?
- Yes. All test files are free to use for any purpose, including commercial development and testing.
- How do I test an HTML parser or web scraper?
- Download sample-html5.html and assert on its structure: the h1 text, the number of section elements, meta description attribute, and link hrefs. Because the file is valid, hand-written HTML, any deviation in your parser output is a parser bug — not a page quirk. Then stress it with sample-table.html, whose caption, scoped headers and nested table exercise table-reconstruction logic.
- What is the difference between .html and .htm?
- Nothing functionally — .htm is a relic of old Windows systems that limited extensions to three characters. Both are served as text/html. Test both spellings only if your upload validation or routing logic distinguishes extensions.
- How do I open an HTML file locally?
- Double-click it or drag it into any browser — the browser renders it from disk. To view the source instead, open it in a text editor or use View Source in the browser. For a local web server (closer to production), run npx serve or python -m http.server and browse to the file.
- Are these HTML files safe to use in automated tests?
- Yes. All fixtures are hand-written, contain no scripts that execute external calls, no remote iframes, and no tracking resources. The script tag in sample-html5.html references a local app.js that does not exist, which is ideal for testing resource-loading fallback paths.