Overview
Microdata embeds schema.org data in HTML attributes. Google supports it alongside RDFa but recommends JSON-LD as the easiest format to maintain at scale, so write Microdata only to maintain or migrate legacy markup. The decision and the JSON-LD playbook are in structured-data.
Use Microdata only when you cannot add a script
Choose Microdata when a CMS lets you edit body HTML but not <head> or inject scripts. Otherwise use JSON-LD, which sits apart from the DOM and survives template changes. JSON-LD can sit in <head> or <body>.
Read the three attributes
itemscope marks an element as an item, itemtype names its schema.org type URL, and itemprop names a property whose value is the element’s content (or an attribute such as datetime).
<article itemscope itemtype="https://schema.org/Article">
<h1 itemprop="headline">HTML Microdata</h1>
<time itemprop="datePublished" datetime="2026-05-14">May 14, 2026</time>
</article>Microdata couples markup to the template, so restructuring the DOM can silently break the hierarchy.
Nest items with itemscope on the property
To describe a complex property such as an author, put itemscope and itemtype on the element that carries the itemprop. Omitting the nested itemscope is the most common bug: the extractor then attaches the inner properties to the parent item.
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
<span itemprop="name">Alex Kim</span>
</div>Migrate to JSON-LD in five steps
- Test existing markup with Google’s Rich Results Test.
- Write a JSON-LD block with the same properties.
- Add it to
<head>. - Remove the Microdata attributes and retest.
- Delete wrapper elements and classes that existed only for the markup.
Do not ship both for the same entity; keep one source of truth. Types and properties are in schema-org-types; the static-site embed is in add-jsonld-to-static-site.