The <output> element
The <output> tag shows the result of a calculation or user action, such as a total price that updates as quantities change. Its for attribute lists the ids of the fields that feed into it. Screen readers treat it as a live status area and announce the new result when it changes.
Last updated: October 3, 2026
Quick facts
| Category | Flow content, phrasing content, form-associated (listed, labelable, resettable), palpable content |
| Content model | Phrasing content |
| Tag omission | Neither the start nor the end tag can be omitted |
| Permitted parents | Any element that accepts phrasing content (usually inside a <form>) |
| DOM interface | HTMLOutputElement |
Syntax
Live example
Edit the code below and watch the preview update instantly.
Attributes
| Attribute | Description |
|---|---|
| for | Space-separated ids of the controls that the result is calculated from |
| name | A name for the element, so scripts can refer to it (e.g. form.total) |
| form | The id of a <form> to belong to, if it sits outside it |
Common examples
A live calculator
The form’s oninput updates the result whenever a number changes.
Showing a slider value
A range input has no visible number; output shows it.
A loan payment estimate
Output is good for any result calculated from what the visitor enters.
<output> vs a <span> result
You could show a calculated result in a <span>, but nothing would tell assistive technology that it’s the result of the form. <output> is a live region by default in most browsers, so screen readers announce the new value when it changes, and its for attribute links it to the inputs it depends on.
It also belongs to the form, so form.elements.total finds it, and form reset restores its original text. Use output for results; use span for text that isn’t calculated from user input.
| <output> | <span> | |
|---|---|---|
| Announced when it changes | Yes (in most browsers) | No |
| Linked to inputs | for attribute | No |
| Part of the form | Yes | No |
Common mistakes to avoid
- Expecting it to be submitted. Output values aren’t sent with the form; copy them into a hidden input if needed.
- Leaving it empty at the start. Show an initial result so the page makes sense before anyone types.
- Using it for static text. If the text never changes, it isn’t an output.
- Forgetting
Number(). Input values are text, so"2" + "3"gives"23"instead of 5.
Accessibility & SEO tips
- Give the output a label or surrounding text (“Total:”) so its meaning is clear when announced.
- Avoid updating the output on every keystroke with long text — screen readers may read it over and over. Short values work best.
- Calculators and converters that give instant results are great “tool” content that people link to and bookmark.
- Round long decimal results with
toFixed()orIntl.NumberFormatso the result is easy to read and announce.
Browser support
Supported in all modern browsers, including Chrome, Edge, Firefox, Safari and their mobile versions. It was introduced with HTML5, and only very old browsers such as Internet Explorer 8 needed workarounds.