Heading Structure Checker
Paste HTML and see where the outline breaks, plus why skipping down is a fault and jumping back up never was.
Headings are found with a regular expression, which is honest about the limits: it reads pasted source and will be fooled by a heading inside a comment or a string. Use it to check a document's shape, not as a substitute for auditing the live page. Nothing is uploaded.
Skipping down is a problem; jumping back up is not
Going down a level claims this section sits inside the last one, so it can descend only one rung at a time. Coming back up makes no nesting claim at all — it closes as many sections as it needs to. "Never skip heading levels", said without a direction, makes people avoid the half that was always fine.
| Move | Allowed? | Why |
|---|---|---|
| h2 → h3 | yes | one step down — a subsection |
| h2 → h4 | no | skips h3, leaving a hole in the outline |
| h4 → h2 | yes | back up two — closes two sections, claims nothing |
| h4 → h1 | yes | back up three — same, and starts a new top section |
| h3 → h3 | yes | a sibling section |
| h1 → h3 | no | skips h2 immediately after the title |
Repeating a level is a sibling section, not a fault. And the only move that can break an outline is a descent of more than one — every disallowed row above goes downward.
The valid outlines are exactly the Catalan numbers
Count the well-formed level sequences with no cap on depth and you get 1, 2, 5, 14, 42, 132, 429 — the Catalan numbers, which is what a bracketing structure gives. Checked against an independent Catalan formula up to fourteen headings.
| Headings | Valid with h1–h6 | Valid with no cap | Catalan | Share of all |
|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 16.6667% |
| 2 | 2 | 2 | 2 | 5.5556% |
| 3 | 5 | 5 | 5 | 2.3148% |
| 4 | 14 | 14 | 14 | 1.0802% |
| 5 | 42 | 42 | 42 | 0.5401% |
| 6 | 132 | 132 | 132 | 0.2829% |
| 7 | 428 | 429 | 429 | 0.1529% |
| 8 | 1,416 | 1,430 | 1,430 | 0.0843% |
| 9 | 4,744 | 4,862 | 4,862 | 0.0471% |
| 10 | 16,016 | 16,796 | 16,796 | 0.0265% |
| 11 | 54,320 | 58,786 | 58,786 | 0.0150% |
| 12 | 184,736 | 208,012 | 208,012 | 0.0085% |
HTML stops at six levels, and that cap first excludes a structure at the 7th heading — 428 against a Catalan 429, the missing one being the outline that would need an h7. By twelve headings the cap has cost 23,276 of 208,012.
The last column is the practical one. Of all the ways to hand six levels to twelve headings, 0.0085% are well formed. A correct outline is not something a document lands on by accident.
Worked examples
Each row is a heading sequence, what is wrong with it if anything, and the nearest valid version — which only ever moves a heading up, never down.
| Sequence | Problems | Repaired |
|---|---|---|
| h1 h2 h3 h2 h3 a normal article | none | — |
| h1 h2 h4 a skipped level | h2 jumps straight to h4, skipping 1 level. | h1 h2 h3 |
| h1 h4 h2 a skip, then a legal climb | h1 jumps straight to h4, skipping 2 levels. | h1 h2 h2 |
| h2 h3 h4 no h1 at all | The first heading is an h2, so the outline has no top level. | h1 h2 h3 |
| h1 h2 h1 h2 two h1 elements | There are 2 h1 elements. One per page is the safe convention. | h1 h2 h1 h2 |
| h1 h2 h2 h2 siblings | none | — |
On the "one h1 per page" rule
HTML5 once specified an outline algorithm under which multiple h1 elements would each be scoped to their sectioning element, making several of them perfectly correct. No browser and no screen reader ever implemented it, and it was eventually removed from the specification. So the practical advice reverted to what it had been: one h1, naming the page, and the structure carried by the numbers rather than by section nesting. This checker flags extra h1 elements for that reason rather than because the markup is invalid — it is a convention that survived because the alternative was never built.
How to use
- Paste markup containing h1 to h6 elements.
- Problems are listed in document order.
- The outline shows the nesting each heading implies.
- Faulty headings are marked in the outline.
Frequently asked questions
Is skipping a heading level always wrong?
Only downward. Going down a level claims this section sits inside the last one, so it may descend just one rung at a time and h2 to h4 leaves a hole. Coming back up makes no nesting claim at all, so h4 straight back to h2 is perfectly well formed. Stating the rule without a direction makes people avoid the half that was always fine.
Can I repeat a heading level?
Yes. Two h2 elements in a row are sibling sections, which is the ordinary case for a document with several parts at the same rank. Nothing about repeating a level breaks an outline.
How many valid outlines are there?
For n headings with no cap on depth, exactly the nth Catalan number: 1, 2, 5, 14, 42, 132, 429 and so on. That is what you would expect once you notice a heading outline is a bracketing, and it is checked here against an independent Catalan formula up to fourteen headings.
Are six heading levels always enough?
No, and the first shortfall arrives sooner than you would think. Six levels handle every outline of six headings or fewer, but at seven headings there are 428 expressible structures against a Catalan 429 — the missing one needs an h7. By twelve headings the cap has cost 23,276 of 208,012.
How likely is a random outline to be correct?
Vanishingly. Of all the ways to assign six levels to twelve headings, 0.0085 per cent are well formed, and the share falls at every length. A correct outline is not something a document arrives at by accident, which is roughly the argument for checking it.
Should a page have only one h1?
In practice yes. HTML5 once specified an outline algorithm under which several h1 elements would each be scoped to their sectioning element, but no browser and no screen reader ever implemented it and it was removed from the specification. The convention survived because the alternative was never built.
How are the headings found?
With a regular expression over the source you paste, which is honest about the limits: it will be fooled by a heading inside a comment or a string, and it cannot see anything a script adds later. Use it to check a document’s shape rather than as a substitute for auditing the live page.
Does this send anything anywhere?
No. Everything is parsed and checked in your browser, and nothing is uploaded.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.