Skip to content

<data> - The Data Element

Inline HTML5

The data element links content with a machine-readable translation via the value attribute, making it useful for automated data processing while displaying human-readable content.

Result
<data value="machine-readable-value">Human readable content</data>

The value attribute contains data in a format suitable for automated processing, while the element content shows what users see.

AttributeDescriptionExample
valueMachine-readable value"SKU-12345", "999.99"
Result
Result
Result
Result
Result
Result
Result
<!-- General machine-readable values -->
<data value="SKU-12345">Premium Widget</data>
<data value="99.99">$99.99</data>

Use for product codes, prices, IDs, and other non-date values.

The value attribute is accessible via JavaScript:

Result

The <data> element has no default styling:

Result
Result

Screen readers read the visible content, not the value attribute. The machine-readable value is only for automated processing.

Make sure the visible content is meaningful to humans:

<!-- Confusing to users -->
<data value="PROD-12345">12345</data>

Don’t use <data> for purely presentational purposes:

<!-- Wrong: no machine processing benefit -->
<data value="red">Red</data>
<!-- Better: just use plain text or CSS -->
<span class="color-red">Red</span>
ScenarioExample
Product IDs<data value="SKU-123">Widget</data>
Prices<data value="99.99">$99.99</data>
Order numbers<data value="ORD-456">Order 456</data>
User IDs<data value="user-789">John</data>
Color codes<data value="#FF0000">Red</data>
Ratings<data value="4.5">⭐⭐⭐⭐☆</data>
BrowserVersionNotes
Chrome62+Full support
Firefox22+Full support
Safari10+Full support
Edge79+Full support
IENoNot supported

The <data> element is an HTML5 feature with good modern browser support.

For dates, times, and durations with machine-readable format. Learn more →