Use JSON-LD. It is a self-contained block of data in a script tag, kept apart from your visible HTML, and Google's documentation recommends it. Microdata also works, because Google reads it too, but it weaves attributes through your page markup, which makes it harder to read, edit and keep correct as the design changes.
Why it matters
Structured data tells search engines what a page is about in a fixed vocabulary from schema.org. The format you choose decides how easy that data is to maintain. A format that breaks whenever someone edits a template creates errors nobody notices until a report flags them.
How to tell them apart
JSON-LD sits in one place, usually in the head or at the end of the body:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to test a sitemap",
"author": { "@type": "Person", "name": "Alex Doe" }
}
</script>
Microdata puts the same facts into the visible elements using attributes:
<article itemscope itemtype="https://schema.org/Article">
<h1 itemprop="headline">How to test a sitemap</h1>
<span itemprop="author" itemscope itemtype="https://schema.org/Person">
<span itemprop="name">Alex Doe</span>
</span>
</article>
How to choose
- Check what your site already outputs. View the page source and search for
application/ld+jsonanditemscope. - For new markup, write JSON-LD. Most content management systems, themes and SEO plugins generate it already.
- If a theme outputs Microdata that passes testing, you do not need to rewrite it just for the format.
- Avoid mixing both formats to describe the same thing. Duplicate descriptions can disagree and are harder to debug.
- Test the result in the Rich Results Test and the Schema Markup Validator after any change.
Whichever format you pick, the same rule applies: mark up what visitors can actually see on the page.
Common mistakes
- Rewriting working Microdata into JSON-LD without testing the result afterwards.
- Leaving old Microdata in a theme while a plugin adds JSON-LD for the same page.
- Describing content in the markup that does not appear on the page.
- Copying a snippet with the example name and URL still in it.
- Placing the JSON-LD block inside an element that a script later removes.
Frequently asked questions
Does Google rank JSON-LD pages higher than Microdata pages?
No. Google documents structured data as helping it understand a page and, for some types, show rich results. The format is a maintenance choice, not a ranking one.
Can I use JSON-LD and Microdata on the same site?
Yes, on different parts of a site, but avoid describing the same item both ways on one page. Pick one format per item.
What about RDFa?
RDFa is a third format that Google also supports. It is less common on ordinary websites, so most guides and tools focus on JSON-LD.
Related guides
- JSON-LD testing and validation
- Rich Results Test errors explained
- Product schema and merchant listings
- Local business schema
Curious how your own markup holds up? Try the free website sample.