HTML optimum Attribute

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 3 Examples
Meter & Progress

Introduction

The optimum attribute is used on the <meter> element to mark the preferred or ideal value on a gauge scale. Together with min, max, and value, it helps browsers show whether the current reading is in a good, medium, or poor zone (colors vary by browser). Use it for disk usage (lower is better), test scores (higher is better), or any measurement with a clear target. It is not form validation — it does not apply to input or progress. Set meter.optimum in JavaScript when the target changes.

What You’ll Learn

01

meter only

One element.

02

Ideal value

Target point.

03

min / max

Scale bounds.

04

value

Current reading.

05

Color zones

Browser hint.

06

.optimum

JS property.

Purpose of optimum Attribute

The primary purpose of optimum is to tell the browser where the ideal point lies on a <meter> scale. The browser compares value to optimum and may color the bar to suggest good vs suboptimal readings — without extra CSS or JavaScript.

Choose optimum based on what “good” means for your metric. For a test score out of 100, optimum="80" means 80% is the target. For disk usage, optimum="20" means low usage is preferred. Always pair with min, max, and value.

💡
Not form validation

optimum does not validate user input or block form submission. It is a display hint for meter gauges only — unlike min or pattern on input elements.

📝 Syntax

Add optimum on a meter element with min, max, and value:

optimum.html
<label for="progress">Task progress:</label>
<meter
  id="progress"
  value="60"
  min="0"
  max="100"
  optimum="75">
  60%
</meter>

Syntax Rules

  • Valid only on <meter> — not on progress or input.
  • Value is a number between min and max (inclusive).
  • Always include min, max, and value on the same element.
  • Include fallback text inside <meter> for browsers without support.
  • JavaScript IDL property: meter.optimum = 90 (number).
  • Browser colors depend on where value sits relative to optimum.
  • Do not confuse meter (measurement with range) with progress (completion).

💎 Values

The optimum attribute accepts a numeric value on the meter scale:

  • optimum="75" with min="0" max="100" — 75 is the ideal target on a 0–100 scale.
  • optimum="20" on disk usage — Lower usage is preferred (optimum near the low end).
  • optimum="90" on a quiz score — Higher scores are preferred (optimum near the high end).
optimum-examples.html
<!-- Higher is better -->
<meter value="72" min="0" max="100" optimum="80">72%</meter>

<!-- Lower is better -->
<meter value="85" min="0" max="100" optimum="25">85% used</meter>

⚡ Quick Reference

AttributeRole on meterExample
minLowest scale value0
maxHighest scale value100
valueCurrent measurement60
optimumIdeal / target value75
meter.optimumJS propertymeter.optimum = 90
progressNo optimumUse meter instead

Applicable Elements

ElementSupported?Notes
<meter>YesOnly valid target
<progress>NoCompletion bar — no optimum
<input>NoUse min / max for validation
<div>, custom gaugesNoNative meter or CSS/JS charts
Related: min, max, valueYesRequired companions on meter

optimum vs value vs progress

ConceptWhat it representsElement
valueCurrent measurementmeter, progress
optimumIdeal target on the scalemeter only
min / maxScale boundariesmeter, inputs, progress
progress elementTask completion (0–100%)No optimum attribute

Examples Gallery

Task progress meter, dynamic meter.optimum, and lower-is-better vs higher-is-better gauges.

👀 Live Preview

Task progress at 60% with optimum 75 (target is higher):

60%

Current: 60 — optimum: 75

Example — meter with optimum

Show task progress with a target of 75%:

meter-optimum.html
<p>Task progress:</p>
<meter
  value="60"
  min="0"
  max="100"
  optimum="75">
  60 out of 100
</meter>
Try It Yourself

How It Works

value="60" is the current reading. optimum="75" marks 75 as the ideal target. The browser may color the bar to show 60 is below the target.

Dynamic Values with JavaScript

Update the optimum target at runtime:

dynamic-optimum.html
<meter id="dynamicMeter" value="85" min="0" max="100">85%</meter>

<script>
  document.getElementById("dynamicMeter").optimum = 90;
</script>
Try It Yourself

How It Works

The optimum IDL property accepts a number. Changing it updates how the browser interprets whether the current value is near the ideal point.

Example — Lower is better vs higher is better

Place optimum near the low end or high end depending on the metric:

optimum-direction.html
<!-- Disk usage: low is good -->
<meter value="85" min="0" max="100" optimum="25">85% used</meter>

<!-- Quiz score: high is good -->
<meter value="72" min="0" max="100" optimum="80">72%</meter>
Try It Yourself

How It Works

Where you place optimum on the scale signals whether lower or higher values are preferred. The browser uses that hint for meter coloring.

♿ Accessibility

  • Label meters — Associate each meter with a visible <label> or nearby heading.
  • Fallback text — Put the numeric value inside <meter> for older browsers.
  • Do not rely on color alone — State the value and target in text (e.g. “60% — target 75%”).
  • meter vs progress — Use progress for known completion; meter for measurements against a range.
  • Screen readers — May announce the value; supplement with explicit optimum in prose when it matters.

🧠 How optimum Works

1

Define scale

min, max, value.

meter
2

Set optimum

Ideal target.

optimum
3

Browser compares

value vs optimum.

Zones
=

Gauge display

Colored hint.

Browser Support

The optimum attribute on <meter> is supported in all modern browsers that support the meter element.

HTML5 Meter · Fully supported

Reliable optimum on meter

Native gauges with ideal-value hints in every major browser.

99% Browser support
Google Chrome Fully supported
Full support
Mozilla Firefox Fully supported
Full support
Apple Safari Fully supported
Full support
Microsoft Edge Fully supported
Full support
Internet Explorer Not supported
No meter
Opera Fully supported
Full support
optimum on meter 99% supported

Bottom line: Safe for native gauge displays in all modern browsers.

💡 Best Practices

✅ Do

  • Use optimum only on meter with min, max, value
  • Pick optimum based on what “good” means for your metric
  • Include fallback text inside <meter>
  • Repeat value and target in visible labels
  • Update meter.optimum when targets change in JS

❌ Don’t

  • Use optimum for form validation
  • Put optimum on progress or input
  • Rely on meter colors alone without text labels
  • Omit min or max on the meter
  • Confuse meter (measurement) with progress (completion)

Conclusion

The optimum attribute marks the ideal value on a meter scale — helping browsers show whether the current reading is near your target.

Pair it with min, max, and value, choose the target thoughtfully for lower-is-better or higher-is-better metrics, and set meter.optimum in JavaScript when needed.

Key Takeaways

Knowledge Unlocked

Five truths every developer should know about optimum

Bookmark these before adding meter gauges.

5
Core concepts
🎯 02

Ideal value

Target point.

Purpose
📊 03

min / max / value

Required trio.

Pair
🔄 04

.optimum JS

Dynamic target.

API
05

Not validation

Display hint.

Gotcha

❓ Frequently Asked Questions

It marks the preferred value on a meter scale. Browsers use it with min, max, and value to suggest good vs suboptimal zones.
Only <meter>. It does not apply to progress, input, or other elements.
No. The old reference incorrectly suggested form validation. optimum is a display hint for gauges. Use min, max, or pattern on inputs for validation.
meter.optimum = 90 — assign a number to the IDL property, or use setAttribute("optimum", "90").
progress shows task completion toward a known total. meter shows a measurement within a range and supports optimum for an ideal target.
Yes on meter in all modern browsers. Internet Explorer did not support the meter element.

Build meter gauges

Practice the optimum attribute on meter with task progress and disk usage examples in the Try It editor.

Try optimum demo →

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.

5 people found this page helpful