H1 and subheadings: how to build a logical heading structure
What is an h1, when do you use h2 and h3, and which mistakes are common? A beginner's guide with examples of good and bad heading structures.
What are headings in HTML?
Headings are the titles above the sections of a page. HTML has six levels, from <h1> (the most important) to <h6>, and together they form the table of contents of your page. Think of a book: the h1 is the title on the cover, the h2s are the chapters and the h3s the sections within a chapter. Most pages do not need levels h4 to h6.
<h1>Starting a vegetable garden on your balcony</h1>
<h2>Which vegetables grow well in a container?</h2>
<h3>Lettuce and spinach</h3>
<h3>Tomatoes and peppers</h3>
<h2>How much sun does a balcony garden need?</h2>
<h2>When should you sow what?</h2>
The indentation in this example only shows the structure; in real HTML, indentation makes no difference. The level is in the number of the tag.
A heading is not the same as large or bold text. A browser shows an h1 large and bold by default, but you can change that styling with CSS. The heading level says something about meaning: this is a title, and this is how important it is. Choose "Heading 2" in your CMS editor and you get an <h2> in the HTML. See also heading structure in the encyclopedia.
Why does heading structure matter?
A good heading structure helps visitors scan a page, helps screen reader users navigate it, and helps search engines see what the page is about.
- Visitors can scan the headings and keep reading where their question is answered. Vague or missing headings force them to read the whole text.
- Screen readers. According to MDN, quickly jumping from heading to heading is a common way to find out what a page contains, and most screen readers can generate a list of all the headings on a page. A heading that is missing or at the wrong level makes that list unclear.
- Google uses headings such as the
<h1>as one of the sources for the title in search results (documentation). In its guide to generative AI features, Google mentions pages organised in paragraphs and sections with headings that provide a clear structure.
What you do not need to do: tune your headings to some supposed Google preference. The SEO Starter Guide says that heading order does not matter for Google Search, although a semantic order is great for screen readers, and that there is no ideal number of headings. So you build a good heading structure for people first. That search engines benefit too is a welcome bonus.
How many h1s can a page have?
Use one <h1> per page, containing the main title of that page. According to MDN, the HTML standard allows multiple h1s as long as they are not nested, but it is not good practice: a page should generally have a single h1 that describes its content, similar to the <title>. Google also recommends making it clear which text is the main title, for example by putting it in the first visible <h1>.
An extra h1 often creeps in through the logo:
<!-- Weak: the logo is an h1 on every page -->
<header>
<h1><a href="/"><img src="/logo.svg" alt="Example Garden Centre home page"></a></h1>
</header>
<main>
<h1>Starting a vegetable garden on your balcony</h1>
</main>
<!-- Better: the logo is just a link, the h1 belongs to the content -->
<header>
<a href="/"><img src="/logo.svg" alt="Example Garden Centre home page"></a>
</header>
<main>
<h1>Starting a vegetable garden on your balcony</h1>
</main>
Other h1s best avoided: "Welcome", "Home" or a slogan that is the same on every page. They say nothing about this particular page.
Can the h1 differ from the title tag? Yes. The title often includes the brand name and is sometimes more formal; the h1 can be shorter or more personal. Just make sure they cover the same subject. See also title tag.
What does a good heading structure look like?
A good heading structure reads like a table of contents: anyone who reads only the headings knows what the page is about and where each answer is. Two examples.
A category page in an online shop
h1 Running shoes
├── h2 Which running shoe suits you?
│ ├── h3 For the road
│ ├── h3 For trails
│ └── h3 For racing
├── h2 How do you find the right size?
└── h2 Frequently asked questions about running shoes
A service page for a heating engineer
h1 Boiler servicing in Leeds
├── h2 What happens during a boiler service?
├── h2 How often does a boiler need servicing?
├── h2 What does a service cost?
│ ├── h3 One-off service
│ └── h3 Service plan
└── h2 How do you book an appointment?
What these examples have in common:
- one h1 that says exactly what the page is;
- h2s for the questions a visitor has, in a logical order;
- h3s only where an h2 really consists of several parts;
- no skipped levels.
Headings in the fixed parts of your site, such as a sidebar or footer, are fine too. The W3C advises giving them the same level on every page, regardless of the content next to them (W3C: Headings). Just do not make them an h1. Put the main content itself in a <main> element, so that browsers and assistive technologies such as screen readers can identify where it starts (W3C: Page Regions).
Which heading mistakes are common?
Most of the mistakes below have one cause: a heading chosen for how it looks rather than for what it means.
1. Choosing a heading level for its font size. MDN is clear about this: do not use headings to make text bigger or smaller; use the CSS font-size property instead.
<!-- Wrong: h4 chosen because it is smaller -->
<h1>Running shoes</h1>
<h4>Free returns</h4>
<!-- Better: ordinary text, styled with CSS -->
<h1>Running shoes</h1>
<p class="benefit">Free returns</p>
2. Skipping levels. Going straight from an h2 to an h4 because the h3 "looks too big". MDN recommends always starting from h1, followed by h2 and so on. The W3C calls skipping confusing and advises avoiding it where possible. Jumping back is fine: after an h4, an h2 can follow when a new main section starts.
3. Bold text instead of a heading.
<!-- Weak: looks like a heading, but is not one -->
<p><strong>Delivery time</strong></p>
<!-- Better: a real heading -->
<h2>How long does delivery take?</h2>
A bold paragraph is still a paragraph in the HTML. A heading that only looks like one is therefore missing from a screen reader's list of headings.
4. No h1, or an h1 that says nothing. "Welcome", "Home" or just the logo. Visitors and search engines then have to guess what the page is about.
5. Vague headings. "More information", "Other" or "Text" do not say what is below the heading. A heading that names the topic is better.
6. Whole sentences or paragraphs in a heading. A heading is a title, not a summary. Keep it short and put the explanation in the paragraph below.
7. Using headings for buttons or slogans. "Call us now!" is not a heading but a call to action. Use a link (<a>) or button (<button>) for it and give it the styling you want with CSS.
How do you write headings that work for Google and AI assistants?
Write headings that say exactly what is in the section, phrased where it fits as the question the reader has, and give a short answer directly below the heading. This article is built the same way: every heading is a question, and the first sentence below it is the answer. A reader who scans only the headings quickly finds the right answer, and a search system that quotes a passage finds a self-contained piece of text. See AEO.
Compare:
| Vague | Descriptive |
|---|---|
| Information | What happens during a boiler service? |
| Prices | What does a boiler service cost? |
| Tips | How do you find the right running shoe size? |
| Other | Can you still change an order? |
Do not overdo it. Not every heading has to be a question, and Google writes in its guide to AI features that you do not need to break your content into tiny pieces or write in a special way for AI. One heading per real topic is enough.
How do you check the heading structure of a page?
List all the headings of a page one below the other and read them as a table of contents: is the order right, is no level missing, and is there one h1?
- Open the page in Chrome, Edge or Firefox and press
F12. Go to the Console tab. - Paste the code below and press Enter. Chrome may first ask you to type
allow pasting. Only paste code you understand.
document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((heading) => {
const level = Number(heading.tagName[1]);
console.log(`${" ".repeat(level - 1)}${heading.tagName} ${heading.textContent.trim()}`);
});
- You now see all headings, indented, one below the other. Check for:
- exactly one H1, at the top of the content;
- no jump from H2 to H4;
- no headings from the menu, sidebar or footer appearing as h1 or h2 among your content;
- headings that together form an understandable table of contents.
Then also look at the page source (Ctrl+U, on a Mac usually Cmd+Option+U) and search for <h1. The console shows the page after JavaScript has run; the source shows what the server sends. If your headings appear only in the console and not in the source, read about server-side rendering.
Checklist
- The page has one
<h1>that says what this page is about. - The h1 and the title tag cover the same subject.
- The logo and fixed texts such as "Welcome" are not an h1.
- Main sections have an
<h2>, parts within them an<h3>. - No level is skipped.
- Heading levels are chosen for meaning; font size is handled with CSS.
- Subheadings are real headings, not bold paragraphs.
- Headings are descriptive and, where it fits, a question with a short answer directly below.
- Anyone reading only the headings understands how the page is built.
The free scan checks, among other things, whether your home page has one h1 and at least two subheadings.
Frequently asked questions
Is it a problem if my page has two h1s?
It is not an error under the HTML standard, and Google sets no fixed number. MDN does recommend one h1 per page, because it describes what the page is about. If you have two, check whether one of them is really an h2, or a logo that does not need to be a heading.
Does the h1 have to match the title tag?
No, but they should cover the same subject. Google uses both the title and headings such as the h1 as sources for the title in search results. When they say the same thing, it is clearer to Google which text is the main title.
Can I skip a level if it looks better?
Preferably not. MDN and the W3C advise against skipping levels because it confuses screen reader users. If you want a different font size, change it with CSS. The W3C mentions one exception: when you close a subsection, you can jump back to a higher level, for example from an h4 to an h2.
Do headings help you appear in AI answers?
In its guide to AI features, Google mentions pages organised in paragraphs and sections with headings that provide a clear structure. At the same time, Google writes that you do not need to write specially for AI or break your content into tiny pieces. Clear headings with an answer directly below mainly help because any reader, human or machine, quickly sees where each answer is.
Sources
- MDN: <h1>–<h6> HTML section heading elements
- W3C WAI: Headings (Page Structure Tutorial)
- W3C WAI: Page Regions
- Google Search Central: SEO Starter Guide
- Google Search Central: Influencing your title links in search results
- Google Search Central: Optimizing your website for generative AI features on Google Search
How visible is your website?
Find out for free how you score in Google and in ChatGPT, Gemini and Claude.
Read also
Site structure for SEO: how to build a logical hierarchy
How do you organise a website logically? Tips for menus, categories, internal links, breadcrumbs and URLs, with examples and mistakes to avoid.
Read more →How to make your website faster: what to do and what to avoid
Is your website slow? Learn how to measure its speed, what really helps and what to avoid. Covers LCP, INP and CLS, with code examples.
Read more →Writing alt text for images: rules and examples
What is alt text, when do you leave it empty, and how do you describe a product photo, logo or chart? A practical guide with good and bad examples.
Read more →