Home >Web >HTML reference – elements and attributes >output – calculation result

output – calculation result

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

The result of a calculation or an action in a form: the price for the chosen quantity, a total, the number of characters left. The value is usually set by a script. Screen readers announce a change of the content by themselves, because output has the status role.

  • Default display: display: inline
  • End tag: required
  • Content: phrasing content
  • Where it can be used: anywhere phrasing content is allowed
  • DOM interface: HTMLOutputElement

Attributes

  • for – the ids of the fields the result comes from (a space-separated list).
  • name, form.

Examples

A price by the number of items:

<form oninput="price.value = (count.valueAsNumber * 4.5).toFixed(2)">
  <label for="count">Number of loaves</label>
  <input type="number" id="count" name="count" min="1" value="1">
  = €<output name="price" for="count">4.50</output>
</form>

Things to watch out for

  • The value of output is not sent with the form.
  • A result calculated in the browser is only information – the server must calculate the price again.

Browser support

Baseline – widely available: in all major browsers since October 2018, considered widely available since April 2021. Since version: Chrome 10, Firefox 4, Safari 7. As of October 2026 (MDN browser-compat-data).

Related:
form – form
input – input field
meter – gauge
progress – task progress