- HTML
- SEO
- Best Practices
Semantic HTML for SEO and Accessibility
How semantic HTML elements like main, nav and article improve accessibility, and what Google actually says about semantic markup and SEO.
Semantic HTML means using elements that describe what content is, such as <header>, <nav>, <main>, <article>, <aside> and <footer>, instead of generic <div> elements. Its clearest benefit is accessibility: screen readers expose these elements as landmarks that users can jump between. For SEO, it makes page structure clearer, but Google says it can rarely depend on HTML semantics, so treat semantic markup as good practice rather than a ranking trick.
Key takeaways
- Semantic elements describe the role of content, and screen readers use them to offer landmark navigation.
- Google's SEO Starter Guide says heading order doesn't matter for Google Search, so semantic HTML is not a ranking shortcut.
- Use one visible
<main>per page,<article>for self-contained content and<section>for thematic groups with a heading. - Keep a logical heading outline without skipped levels, and choose heading levels for structure, not font size.
What is semantic HTML?
HTML (HyperText Markup Language) is the foundation of every website. Before HTML5 added elements like <header>, <nav> and <article>, most page layouts were built almost entirely from generic <div> (division) elements.
You would see code like:
<div id="header">...</div>
<div id="nav">...</div>
<div class="article">...</div>
<div id="footer">...</div>
This works visually (thanks to CSS), but the markup itself says nothing about meaning. A screen reader, used by blind and low-vision people, sees a pile of boxes. It can't tell which box is the main content and which is just a sidebar ad. The IDs and class names help human developers, but browsers and assistive technologies don't interpret them.
Semantic HTML fixes this. It uses elements that describe the meaning (semantics) of the content they hold.
Why does semantic HTML matter?
1. Accessibility (a11y)
The web is for everyone. Screen readers such as NVDA, JAWS and VoiceOver read pages aloud and let users navigate them by structure.
Elements such as <nav>, <main> and <aside>, along with a top-level <header> and <footer>, map to ARIA landmark roles. Screen reader users can list a page's landmarks and jump straight to the main content or the navigation (W3C ARIA Authoring Practices: landmark regions). Without them, a user may have to move through every link in your header on every page before reaching the content.
2. SEO: What does semantic HTML do, and what doesn't it do?
Google needs to understand your content to show it for relevant searches. Clear structure helps people and machines alike: descriptive headings, an obvious main content area, real links written as <a href> and text alternatives on images.
But semantic elements are not a ranking shortcut. In its SEO Starter Guide, Google says: "Having your headings in semantic order is fantastic for screen readers, but from Google Search perspective, it doesn't matter if you're using them out of order. The web in general is not valid HTML, so Google Search can rarely depend on semantic meanings hidden in the HTML specification." (Google Search Central: SEO Starter Guide)
So wrapping a post in <article> doesn't directly boost its rankings, and Google hasn't documented any ranking bonus or penalty tied to specific elements such as <aside>. Use semantic HTML because it makes pages accessible and code maintainable. For search, focus on helpful content, descriptive titles and crawlable links.
Which semantic elements should you use?
Here are the most important elements to know.
<main>
The <main> element represents the dominant content of the <body> of a document.
- Rule: A page must not have more than one visible
<main>element (MDN: the main element). - Use case: The content that is unique to that page, such as the blog post text or the product details. It should not include content repeated across pages, like the site header, sidebar or footer.
<header> and <footer>
These sound self-explanatory, but they are often misused.
- Site header: Contains the logo, main navigation and search bar.
- Article header: You can also use
<header>inside an article to group the title, author and date. - Footer: Copyright information, contact details, sitemap links and social links. Like
<header>, it can also be used inside an article.
<nav>
The <nav> element marks major blocks of navigation links.
- Don't overuse it: Not every group of links needs
<nav>. A short list of links in the footer often doesn't. Use it for major navigation such as your primary site menu or a table of contents.
<article> vs <section>
This is a common source of confusion.
<article>: A self-contained composition that makes sense on its own. If you took this content and published it in a feed or printed it on a piece of paper, would it still make sense?- Examples: A blog post, a news story, a product card, a forum post.
<section>: A thematic grouping of content, typically with a heading, that forms part of a larger whole.- Examples: The "Features" part of a landing page, the "Comments" area of a blog post.
Example structure:
<article>
<h1>How to Cook Pasta</h1>
<p>Intro...</p>
<section>
<h2>Ingredients</h2>
<ul>...</ul>
</section>
<section>
<h2>Instructions</h2>
<ol>...</ol>
</section>
</article>
<aside>
Content that is only indirectly related to the content around it.
- Use cases: Sidebars, "Related articles" lists, call-out boxes and advertising slots.
How should you structure headings?
Headings form the outline of your document, and many screen reader users navigate a page by jumping from heading to heading.
Rules to follow:
- Use one
<h1>per page: It is the main title. The HTML standard allows more than one, but MDN recommends a single<h1>per page as a best practice and advises against skipping heading levels (MDN: heading elements). - Don't skip levels: Don't jump from
<h1>straight to<h3>. It makes the outline harder to follow for screen reader users. - Don't choose headings for size: Don't use an
<h3>just because you want smaller text. Use CSS for styling and headings for structure.
Practical example: a semantic page layout
<body>
<!-- Site header -->
<header>
<nav>
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav>
</header>
<!-- Main content -->
<main>
<article>
<header>
<h1>Understanding Semantics</h1>
<p>By Atish</p>
</header>
<p>This is the intro...</p>
<section>
<h2>Why it helps</h2>
<p>Details here...</p>
</section>
</article>
</main>
<!-- Sidebar -->
<aside>
<h2>Related Posts</h2>
<ul>...</ul>
</aside>
<!-- Footer -->
<footer>
<p>© WebFiddle</p>
</footer>
</body>
Try it in the HTML, CSS & JavaScript editor: paste the layout, then open your browser's developer tools and inspect the accessibility tree to see the landmarks each element creates. To lay these regions out on screen, read CSS Grid vs Flexbox: when to use which.
Conclusion
Semantic HTML isn't about being a purist. It makes your pages usable for people who rely on assistive technology, it makes your structure clear to other developers and tools, and it costs almost nothing compared with <div> soup. Just don't expect it to raise your rankings on its own.
If you're still learning the building blocks, start with HTML basics: tags, attributes and structure. Then start using meaningful elements today; your <div> soup days are over.
Frequently asked questions
Is semantic HTML a Google ranking factor?
Google has not described semantic elements as a ranking factor. Its SEO Starter Guide says heading order does not matter for Google Search and that Google can rarely depend on semantic meaning in HTML, because much of the web is not valid markup. Semantic HTML still improves accessibility and clarity, which makes pages better for visitors.
What is the difference between article and section in HTML?
An article element holds content that makes sense on its own, such as a blog post, news story, product card or forum post. A section groups related content within a larger whole and usually has a heading, like the ingredients part of a recipe. An article can contain sections, and a section can contain articles.
Can a page have more than one h1?
The HTML standard allows multiple h1 elements, and Google says heading order does not affect Google Search. Even so, MDN recommends a single h1 per page as a best practice, because one clear top-level heading gives screen reader users an obvious starting point. Use h2 through h6 for the sections below it.
Does semantic HTML improve accessibility?
Yes. Screen readers use semantic elements to announce what content is and to build lists of landmarks and headings that users can jump between. Native elements also come with built-in roles, and interactive ones such as buttons include keyboard support, so you need far less extra ARIA code to make an interface usable.
WebFiddle