Codectionary / Developer documentation / HTML

<output>

The <output> element represents the result of a calculation performed by a script, often used within a form to show a live computed value — like the result of a slider-driven calculation. It can be associated with the form controls that influence its value via the for attribute.

Syntax

<output name="result" for="a b">0</output>

Examples

Simple Calculation Display

Showing the sum of two number inputs, updated live with JavaScript.

<form oninput="result.value = parseInt(a.value || 0) + parseInt(b.value || 0)">
  <input type="number" id="a" name="a" value="0"> +
  <input type="number" id="b" name="b" value="0"> =
  <output name="result" for="a b">0</output>
</form>

Slider with Live Output

A common pattern pairing a range input with output.

<input type="range" id="volume" min="0" max="100" value="50" oninput="vol.value = volume.value">
<output id="vol" for="volume">50</output>

Styled Output

Styling the output like a result badge.

<output style="display: inline-block; background: #dbeafe; color: #1e40af; padding: 4px 12px; border-radius: 999px; font-weight: 600;">$42.50</output>

Attributes

  • for (string): A space-separated list of IDs of elements that contributed to the calculation
  • name (string): Names the output for form submission

Best practices

  • Use output for genuinely calculated or derived values, not as a generic text container
  • Set the for attribute to link the output back to the inputs it depends on, improving accessibility
  • Combine with the oninput event on the parent form for live updates without a submit step
  • Provide an initial value inside the tags so the output is not empty before any calculation runs

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

<output>

Desktop

Chrome
Supported
From 10
Firefox
Supported
From 4
Safari
Supported
From 7
Edge
Supported
By 18 (possibly earlier)
Opera
Supported
From 11

Mobile

Safari on iOS
Supported
From 7
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 10

Firefox

  • From 4

Safari

  • From 7

Edge

  • By 18 (possibly earlier)

Opera

  • From 11

Safari on iOS

  • From 7

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0
<output> for

Desktop

Chrome
Supported
From 10
Firefox
Supported
From 4
Safari
Supported
From 7
Edge
Supported
By 18 (possibly earlier)
Opera
Supported
From 11

Mobile

Safari on iOS
Supported
From 7
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 10

Firefox

  • From 4

Safari

  • From 7

Edge

  • By 18 (possibly earlier)

Opera

  • From 11

Safari on iOS

  • From 7

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0
<output> name

Desktop

Chrome
Supported
From 10
Firefox
Supported
From 4
Safari
Supported
From 7
Edge
Supported
By 18 (possibly earlier)
Opera
Supported
From 11

Mobile

Safari on iOS
Supported
From 7
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature

Support history and limitations

Chrome

  • From 10

Firefox

  • From 4

Safari

  • From 7

Edge

  • By 18 (possibly earlier)

Opera

  • From 11

Safari on iOS

  • From 7

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading