References

Beginner-friendly references for web development, with live, editable examples.

The HTML itemid attribute

Global attribute Works on every element All modern browsers Updated
Quick answer

The HTML itemid attribute gives a microdata item a globally unique identifier, expressed as a URL. It is used together with itemscope and itemtype, for vocabularies whose types support a unique ID.

Overview

The itemid attribute attaches a stable, globally unique identifier — written as a URL — to a microdata item. It lets different pages or items refer to the same underlying thing (a specific book, product or person), which some schema.org vocabularies use.

It is only meaningful on an element that already has both itemscope and an itemtype whose definition supports global identifiers.

Syntax

<div itemscope itemtype="https://schema.org/Book" itemid="urn:isbn:0-330-25864-8"> … </div>

Values

Value
A URL (or URN) that uniquely identifies the item.

Example

Live example
<div itemscope itemtype="https://schema.org/Book" itemid="urn:isbn:978-0131103627">
  <span itemprop="name">The C Programming Language</span>
</div>

Best practices

  • Use a consistent vocabulary (such as schema.org) via itemtype.
  • Start an item with itemscope and describe its fields with itemprop.
  • Consider JSON-LD as an alternative — many teams find it easier to maintain than inline microdata.
  • Validate your structured data with a testing tool.

Frequently asked questions

What does the itemid attribute do?
Specifies the unique item id.
What is HTML microdata?
A way to mark up structured data inline using itemscope, itemprop and related attributes so machines can read it.
Should I use microdata or JSON-LD?
Both work. JSON-LD keeps structured data in one script block and is often easier to maintain; microdata annotates the visible markup directly.
Is itemid a global attribute?
Yes — it is a global attribute, so it can be set on any HTML element (it is a global attribute).