How to use HTML5 Boilerplate Generator
- Enter your page title and description.
- Generate the document and copy it.
- Set the lang attribute to your page’s actual language.
- charset must be within the first 1024 bytes of the document.
- Without a viewport tag, mobile browsers render at 980px and scale down.
- The lang attribute is a WCAG requirement, not an optional extra.
The two tags that must come first
charset must appear within the first 1024 bytes, or the browser may start parsing with the wrong encoding and re-parse when it finds out — which is why it is the first thing in the head. The viewport tag is what makes a page respond to phone widths at all: without it mobile browsers render at a virtual 980px and scale down, so a perfectly responsive stylesheet produces a tiny, zoomed-out page. Those two omissions account for most “my site looks wrong on mobile” reports.
What belongs in the head and what does not
Title, description, canonical, viewport, charset and the Open Graph tags earn their place. The keywords meta tag has been ignored since 2009. A long block of render-blocking scripts does not belong there either — defer them, or move them before the closing body tag, because anything blocking in the head delays the first paint of the entire page.
lang is an accessibility requirement, not a formality
The lang attribute on the html element tells a screen reader which pronunciation rules to use. Without it, English text may be read with the wrong phonetics, which for a blind user ranges from irritating to incomprehensible. It is one attribute, it is required by WCAG, and it is missing from a remarkable number of production sites.
Frequently asked questions
What is an HTML boilerplate?
What does the CSS reset do?
Why include Open Graph and Twitter tags?
What does the viewport meta tag do?
Do I still need the charset declaration?
What should not go in the head?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.