The <data> element links human-readable content to a machine-readable form. Put the text people should see inside the tag, and put the coded form in the value attribute.
Use it for product IDs, codes, or other strings scripts can parse. If the content is a date or time, use <time> instead (MDN / HTML spec).
Baseline · Widely available.
Not deprecated. Widely available across browsers since about October 2017.
Not the same as data-*.
<data> is an element with value. Custom data-* attributes can go on any element and are a different feature.
Syntax
HTML Syntax
syntax.html
<data value="machine-value">readable text</data>
Both start and end tags are required. Content is phrasing content. The DOM interface is HTMLDataElement; scripts can read element.value.
Follow the spec. MDN: if the content is time-related, you must use <time>.
Edge Cases & Pitfalls
Most mistakes mix up data, data-*, and time.
semantics
Dates belong in <time>
Do not use <data> for calendar dates or clock times. Use <time> with datetime.
naming
<data> ≠ data-*
Custom attributes like data-price are unrelated. See data-*.
value
Empty or missing value
Without a useful value, prefer a normal phrase element. The point of <data> is the machine translation.
a11y
Visible text still matters
Screen readers use the content, not a hidden ID. Keep the text clear; do not put the only meaningful label only in value.
js
Read .value, not inventing APIs
HTMLDataElement.value mirrors the attribute. That is not the same as dataset on other elements.
Compatibility
Browser Support
The <data> element is standard HTML. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<data>
Widely available since about October 2017. Chrome, Firefox, Safari, Edge, and Opera support the element and HTMLDataElement.value.
96%Global support (approx.)
Google Chrome62+
Full support
Mozilla Firefox22+
Full support
Apple Safari10+
Full support
Microsoft Edge14+
Full support
Opera49+
Full support
Samsung Internet8+
Full support
Internet ExplorerNo
Not supported
<data>Widely supported
Bottom line: Safe for modern sites. Internet Explorer has no support — pair with plain text fallbacks only if you still target IE.
Remember
Key Takeaways
Role: human text inside; machine form in value.
Dates: use <time>, not <data>.
Naming:<data> ≠ data-* attributes.
JS: read HTMLDataElement.value when you need the coded form.
One line:<data value="…"> shows people a label and gives machines a parseable value.
UA style
Default CSS Settings
Browsers treat <data> like ordinary phrasing content. There is no special default look:
default.css
data {
display: inline;
}
Add your own styles only if you need a visual cue. Keep focus and contrast accessible if you make it interactive later.
Frequently Asked Questions
The data element links human-readable text to a machine-readable form with the value attribute. Users see the text content; scripts can read the value.
No. The data element is a specific tag with a value attribute. data-* attributes are custom attributes you can add to any element (for example data-id) and read via element.dataset.
Yes for its purpose. value holds the machine-readable translation of the content. Without it, use a normal phrasing element instead.
If the content is a date or time, use the time element with datetime. Use data for other machine-readable strings such as product IDs or numeric codes.
Select the element and use its value property from HTMLDataElement, for example document.querySelector("data").value.
No. By default it looks like ordinary inline text. Add CSS only if you need a visible cue for learners or your design.