HTML optimum Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The optimum attribute on a <meter> marks the preferred numeric value inside the measured range (min–max).

With low and high, it tells the browser which part of the scale is better. For example, if optimum sits between min and low, the lower range is preferred. Browsers may color the bar based on how value relates to that preference. It does not apply to <progress>.

Baseline · Widely available.

Not deprecated and not experimental. Stable with the <meter> element across modern browsers since about March 2017.

Not the same as value.

value is the current reading. optimum is only the preferred point / region hint for the gauge.

HTML Syntax

syntax.html
<meter optimum=" number">…</meter>

number must lie within min and max. Script: meter.optimum = 80.

Attribute Values

How optimum fits on a <meter> scale:

Value / placementDescriptionTry it
numberPreferred point inside min–maxTry it
Near max / high zoneHigher readings are preferred (fuel, score, battery)Try it
Near min / low zoneLower readings are preferred (disk used, latency)Try it
With low / highDefines which band is the “good” regionTry it

Live Preview

Change optimum on a fixed reading (value="50"). Meter color may shift by browser when the preferred point moves between low / mid / high.

Fixed: min="0" max="100" low="33" high="66" value="50".

Meter
50 out of 100

optimum="80" — higher readings preferred.

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Higher Is Better

Fuel tank: put optimum near the top of the scale.

HTML
<label for="fuel">Fuel level:</label>
<meter
  id="fuel"
  min="0"
  max="100"
  low="33"
  high="66"
  optimum="80"
  value="50">
  at 50/100
</meter>
Try It Yourself

How It Works

  1. Scale — min/max define 0–100.
  2. Bands — low/high split low / mid / high zones.
  3. optimum="80" — prefers the high end of the tank.
  4. value="50" — current reading; UI may look “less good” than near 80.

Example 2 — Lower Is Better

Put optimum in the low zone when a small reading is preferred.

HTML
<label for="disk">Disk used:</label>
<meter
  id="disk"
  min="0"
  max="100"
  low="40"
  high="80"
  optimum="20"
  value="75">
  75% used
</meter>
Try It Yourself

How It Works

  1. optimum="20" sits between min and low.
  2. MDN meaning: the lower range is considered preferred.
  3. value="75" is far from that preferred low zone.
  4. Use case: usage, latency, error rate — where “less” is better.

Example 3 — Compare Two Preferences

Same value, different optimum — see how preference changes the story.

HTML
<p>
  <label for="a">High preferred:</label>
  <meter id="a" min="0" max="100" low="33" high="66" optimum="90" value="50">50</meter>
</p>
<p>
  <label for="b">Low preferred:</label>
  <meter id="b" min="0" max="100" low="33" high="66" optimum="10" value="50">50</meter>
</p>
Try It Yourself

How It Works

  1. Same value (50) on both meters.
  2. First meter prefers ~90 — mid reading looks farther from ideal.
  3. Second meter prefers ~10 — mid reading also looks imperfect, but for the opposite goal.
  4. Always pair with labels so users know what “good” means.

Edge Cases & Pitfalls

Most mistakes confuse optimum with the current reading or use it on the wrong element.

element

Only valid on <meter>

Do not put optimum on <progress> or range inputs — it will not apply.

range

Keep optimum inside min–max

MDN requires the preferred value to lie within the measured range. Invalid numbers get clamped or ignored by the UA.

color

Bar color is browser-dependent

Do not rely on a specific green/yellow/red look. Always provide visible text or a label for the meaning.

bands

Order low and high correctly

Use min ≤ low ≤ high ≤ max. Then place optimum where “good” lives.

fallback

Put readable text inside the tag

Content like 50/100 helps when the gauge UI is limited or styled away.

Browser Support

optimum is an attribute of the HTML <meter> element. It is not used on progress bars or Node.js APIs.

✓ Baseline · Widely available

optimum

Widely available with <meter> since about March 2017. Gauge styling still differs by browser.

96% Global support (approx.)
Google Chrome All modern
Full support
Mozilla Firefox All modern
Full support
Apple Safari All modern
Full support
Microsoft Edge All modern
Full support
Opera All modern
Full support
Samsung Internet Modern
Full support
Internet Explorer No support
Not supported
optimum Widely supported

Bottom line: Safe to use on meter. Always label what “optimum” means; do not depend on color alone.

Key Takeaways

  • Role: preferred point on a <meter> scale.
  • Placement: high = more is better; low = less is better.
  • Pair with: low, high, min, max, value.
  • A11y: explain “good” in text — colors vary.

One line: optimum marks where “good” lives on a meter — not the current reading.

Frequently Asked Questions

On a meter element, optimum marks the preferred numeric value inside the min–max range. With low and high, it tells the browser which part of the scale is better. Browsers may color the bar based on how value relates to that preferred zone.
Only the meter element. It does not apply to progress, input type=range, or other form controls.
Yes. MDN: optimum must be within the range defined by min and max.
If optimum is between min and low, the lower part of the scale is considered preferred (for example disk free space or load where lower is better).
No. value is the current reading. optimum is the preferred point or region hint. They can be far apart.
Use the HTMLMeterElement.optimum property with a number, for example meter.optimum = 80.

Next: pattern

Validate text input with a regular expression pattern.

pattern tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful