HTML Microdata Syntax, Schema.org Vocabulary and Structured Data Formats
How Microdata, RDFa, and JSON-LD express Schema.org items and properties, plus limits, nesting, and how to verify markup.
This page summarizes WHATWG HTML Microdata, the Schema.org FAQ, and Schema.org’s example markup across types, together with structured-data rules from Google Search documentation where those guides add requirements beyond the vocabulary itself.
Structured data on ordinary web pages is a set of name–value pairs grouped into items (each item is one thing) and properties (fields on that thing). Publishers attach a shared vocabulary—most often Schema.org—so crawlers and applications can read prices, events, recipes, and organizations consistently. The same vocabulary can be written in HTML Microdata, RDFa, or JSON-LD; Schema.org’s type pages typically show all three side by side on examples such as Product and Recipe.
At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property.
— WHATWG, 5 Microdata — Edition for Web Developers
Schema.org is a joint effort, in the spirit of sitemaps.org, to improve the web by creating a structured data markup schema supported by major search engines.
— Schema.org, FAQ
Microdata: itemscope, itemprop, itemtype, and itemref
Section titled “Microdata: itemscope, itemprop, itemtype, and itemref”Microdata marks items on real HTML elements. To create an item, use itemscope on an element. Give the item a vocabulary type with itemtype (a URL, commonly https://schema.org/Product or https://schema.org/Event). Add properties with itemprop on descendants of that itemscope element.
Nested objects work by putting itemprop and itemscope on the same element: the property’s value is another item (for example address → PostalAddress inside Person). A top-level item should not sit inside another item’s scope unless it is deliberately modeled as a nested property value.
itemref lets properties live outside the itemscope subtree. On the item element, set itemref to a space-separated list of element id values; a Microdata processor also reads itemprop on those referenced elements.
How property values are read in Microdata
Section titled “How property values are read in Microdata”| Situation | Typical extraction |
|---|---|
Plain element with itemprop |
Text content (string) |
a[href], img[src], link[href] |
URL |
meta[itemprop][content] |
content attribute (hidden machine values) |
time[itemprop][datetime] |
Date/time from datetime |
meter[itemprop][value] |
Number |
data[itemprop][value] |
Machine value in value; human text in element body |
You can repeat the same property name with different elements (for example two itemprop="recipeIngredient" lines). One element may carry several names in a single itemprop attribute (space-separated).
It’s important to note that there is no relationship between the microdata and the content of the document where the microdata is marked up.
— WHATWG, 5 Microdata — Edition for Web Developers
That separation matters for accessibility and UX: microdata does not tie markup to figure captions, headings, or layout. You should still follow Schema.org’s visibility rule (below) so consumers trust the data.
Built-in Microdata vocabularies (vCard and vEvent)
Section titled “Built-in Microdata vocabularies (vCard and vEvent)”Besides Schema.org, HTML defines built-in item types such as hCard (http://microformats.org/profile/hcard) for contacts and vEvent (http://microformats.org/profile/hcalendar#vevent) for events. An hCard item needs exactly one fn; vEvent needs exactly one dtstart, and either dtend or duration, not both. For all-day events, dtend is exclusive—the end date is the day after the last day. These vocabularies do not support global item identifiers the way some JSON-LD graphs use @id.
Schema.org vocabulary: partial markup, visibility, and URL scheme
Section titled “Schema.org vocabulary: partial markup, visibility, and URL scheme”Schema.org is a collaborative vocabulary (not a formal standards body like W3C). It exists because extraction alone is unreliable when sites represent the same facts differently.
Automated data extraction is great when it works, but it can be error prone because different sites can represent the same information in so many different ways. Markup provides a consistent way for computers to understand the data on a page
— Schema.org, FAQ
Partial markup is allowed. You do not need every property on a type.
It is fine to mark up only some properties of an item - markup is not an all-or-nothing choice.
— Schema.org, FAQ
Prefer visible content. Mark data users can see on the page, not hidden promotional blocks.
As a general rule, you should mark up only the content that is visible to people who visit the web page and not content in hidden div’s or other hidden page elements.
— Schema.org, FAQ
Legacy formats such as microformats or older Google-supported markup can often stay in place if already consumed; migration to Schema.org is optional but often helpful long term (FAQ).
Type URLs: both http://schema.org and https://schema.org work; examples increasingly use https://schema.org.
For some time now we have been supporting multiple syntaxes, specifically including RDFa and JSON-LD. There are certain things that are much harder in Microdata, like mixing vocabularies, or inverting the direction of a property relationship.
— Schema.org, FAQ
Microdata vs RDFa vs JSON-LD: when to use which
Section titled “Microdata vs RDFa vs JSON-LD: when to use which”| Format | How it attaches | Strengths | Friction |
|---|---|---|---|
| Microdata | itemscope / itemtype / itemprop on HTML |
Keeps markup next to visible content | Mixing vocabularies is harder (FAQ) |
| RDFa | vocab, typeof, property on HTML |
Same page as content; explicit graphs in advanced cases | More attributes to manage |
| JSON-LD | <script type="application/ld+json"> |
Easy nesting, @graph, @id; preferred in many Google examples |
Must stay in sync with visible page content |
Google’s feature guides (for example Dataset, Event, Recipe) state that the same Schema.org vocabulary can appear in JSON-LD, Microdata, or RDFa, while worked examples are often JSON-LD. For dataset discovery, JSON-LD with schema.org is described as the pattern exercised in Google’s testing workflow (Dataset).
Nested types: addresses, offers, ratings, and nutrition
Section titled “Nested types: addresses, offers, ratings, and nutrition”Most real pages nest types rather than flattening everything.
PostalAddress and Place
Section titled “PostalAddress and Place”Events and local businesses put the venue under location → Place with name and nested address → PostalAddress (streetAddress, addressLocality, addressRegion, postalCode, addressCountry). JSON-LD often adds extendedAddress separately from streetAddress on Person addresses.
Offer, price, and availability
Section titled “Offer, price, and availability”Commerce markup usually chains offers → Offer with price, priceCurrency, and availability as a Schema.org IRI such as InStock—not free text alone.
In Microdata, locale-formatted visible prices often pair with machine-readable content on the same element:
price is 1000, a number, with locale-specific thousands separator and decimal mark, and the $ character is marked up with the machine-readable code “USD”
— Schema.org, Offer
AggregateOffer summarizes multiple sellers with lowPrice, highPrice, and offerCount, and may nest individual Offer URLs (Product, offers). Google merchant listings are stricter than generic product snippets: they require a nested Offer (not only AggregateOffer), an active price greater than zero, and crawlable product images (merchant listing).
Ratings and reviews
Section titled “Ratings and reviews”aggregateRating → AggregateRating carries ratingValue and reviewCount. Individual Review objects use reviewRating → Rating with optional bestRating, worstRating, and reviewAspect. A review can stand alone with itemReviewed pointing at a Restaurant or embed under Product / Book.
Recipes and NutritionInformation
Section titled “Recipes and NutritionInformation”Put calories and fatContent under nutrition → NutritionInformation, not on the root Recipe. Durations use ISO 8601 in prepTime, cookTime, and totalTime (prepTime). Google’s Recipe guide requires name and crawlable image; it recommends recipeInstructions as HowToStep (put step labels in name, not inside text).
Page wrapper: mainEntity and mainEntityOfPage
Section titled “Page wrapper: mainEntity and mainEntityOfPage”A detail page can be a WebPage whose mainEntity is the primary Book or Restaurant. The entity may point back with mainEntityOfPage to the canonical URL.
Google overlays on Schema.org types (where docs add rules)
Section titled “Google overlays on Schema.org types (where docs add rules)”Schema.org examples teach shape; Google’s appearance docs add eligibility rules for specific features.
Required properties include name (event title, not the venue), startDate with date and time in ISO 8601, and location with a detailed PostalAddress. Use location.name for the venue; do not put the venue in the event name.
DO NOT put the name of the event location. Instead, use location.name to specify the name of the location where the event is being held.
— Google, Event structured data
When status changes, set eventStatus (for example EventCancelled or EventRescheduled) but do not remove startDate—Google uses it to identify the same event. Postponed events without a new date keep the original startDate until rescheduled (Event).
Required: name and description (50–5000 characters; Markdown allowed with absolute image URLs). Use citation for related academic articles, not to cite the dataset itself. License URLs should identify a specific version (Dataset). For packaged open data, Schema.org’s Data and Datasets overview positions Dataset alongside DataCatalog and DataDownload.
Nesting policy
Section titled “Nesting policy”Google expects one main type with nested satellites—for example a Recipe containing aggregateRating and video (general structured data policies).
Here’s an example of nested structured data, where Recipe is the main item, and aggregateRating and video are nested in the Recipe.
— Google, Structured data policies
additionalProperty, accessibility metadata, and Q&A
Section titled “additionalProperty, accessibility metadata, and Q&A”Product specs often use additionalProperty → PropertyValue with name, value, unitText or UN/CEFACT unitCode, ranges (minValue / maxValue), or nested valueReference for compound readings (additionalProperty).
Accessibility on Book and related types uses accessibilityFeature, accessibilityControl, accessibilityHazard, and accessibilityAPI. Values are not a fixed enumeration; examples follow expert consensus text (accessibilityFeature).
Q&A pages use QAPage with mainEntity → Question, acceptedAnswer and suggestedAnswer → Answer. Microdata can combine itemprop="suggestedAnswer acceptedAnswer" on one element (Question).
HowTo hierarchy and step media
Section titled “HowTo hierarchy and step media”Long instructions use HowTo → step → HowToSection → HowToStep → HowToDirection or HowToTip, each with position. Attach beforeMedia, duringMedia, and afterMedia on directions to show state before, during, and after a step (HowToDirection). totalTime and estimatedCost use ISO 8601 durations such as PT30M (totalTime).
Common mistakes
Section titled “Common mistakes”- Marking only hidden
metablocks that do not reflect visible page content (FAQ). - Confusing event name and venue name on Event (Google Event).
- Removing
startDatewhen an event is cancelled instead of settingeventStatus. - Putting
calorieson the Recipe root instead of undernutrition(NutritionInformation). - Using plain text for
availabilityinstead ofhttps://schema.org/InStock(InStock). - Trusting display-formatted prices without a machine-readable
priceandpriceCurrency(price). - Using
AggregateOfferalone for Google merchant listings when a concrete sellerOfferis required (merchant listing). - Mixing
interactionTypeURIs inconsistently (CommentActionvshttps://schema.org/Comment) across formats on the same page (Recipe). - Assuming Microdata structure implies visual association with captions or figures (WHATWG Microdata).
How to check this on your site
Section titled “How to check this on your site”- Compare JSON-LD or Microdata on the live page to visible titles, prices, dates, and addresses—especially for Offer and Event fields.
- For image-dependent types, follow crawlability guidance in Recipe structured data and merchant listing (image URLs must be crawlable and indexable).
- For events, confirm ISO 8601
startDate/endDate, correctlocation.name, andeventStatuswhen cancelled or rescheduled (Event structured data). - For datasets, check
descriptionlength, license URL specificity, and thatcitationreferences papers—not the dataset record itself (Dataset). - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will correct or clarify it.