HTML min Attribute

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 3 Examples
Forms & Input

Introduction

The min attribute sets the minimum allowed value on certain <input> types and defines the lower bound of the scale on <meter> and <progress> elements. It is essential for form validation—preventing zero or negative quantities, blocking dates before a cutoff, and anchoring range sliders. Pair it with max to define a valid range. Do not confuse min with minlength (minimum character count on text inputs) or low on <meter> (warning threshold, not the scale limit).

What You’ll Learn

01

Lower limit

Floor user input.

02

number & range

Numeric min value.

03

date & time

Earliest pickable.

04

vs max

Valid range pair.

05

vs minlength

Value vs chars.

06

.min JS

Update at runtime.

Purpose of min Attribute

The primary purpose of min is to enforce a lower bound on values the user can submit. A quantity field with min="1" rejects zero or negative orders. A date field with min="2026-01-01" blocks dates before that day. A range slider with min="0" and max="100" maps its track to that numeric span.

Browsers use min during constraint validation. Values strictly below min make the control invalid; the form may not submit until the value is corrected (unless JavaScript bypasses checks). This is client-side guidance only—always re-validate on the server.

💡
Greater than or equal to min

A value of 1 with min="1" is valid. The old reference incorrectly said input must “exceed” the minimum—the rule is value ≥ min, not strictly greater than.

📝 Syntax

Add min with a value matching the input type’s format:

min.html
<label for="quantity">Quantity:</label>

<input type="number" id="quantity" name="quantity" min="1" max="100" value="1">



<label for="startDate">Start date:</label>

<input type="date" id="startDate" min="2026-01-01">



<label for="volume">Volume:</label>

<input type="range" id="volume" min="0" max="100" value="50">



<meter min="0" max="100" value="72"></meter>

Syntax Rules

  • Value format depends on input type: number/range use numbers; date uses YYYY-MM-DD; time uses HH:MM.
  • Valid on number, range, date, time, datetime-local, month, week, meter, and progress.
  • Not valid on text-like inputs—use minlength for character minimums.
  • Pair with max; ensure minmax.
  • JavaScript IDL property: inputElement.min = "5" (string).
  • Works with step on number and range inputs for increment alignment.

💎 Values

The min attribute accepts a string whose meaning depends on the control type:

  • min="1" on type="number" — Lowest allowed integer (e.g. quantity at least 1).
  • min="0" on type="range" — Left end of the slider track.
  • min="2026-01-01" on type="date" — Earliest selectable date.
  • min="09:00" on type="time" — Earliest selectable time.
  • min="0" on <meter> or <progress> — Lower bound of the scale (not the current value).
min-js.html
document.getElementById("dynamicMinField").min = "5";

document.getElementById("startDate").setAttribute("min", "2026-06-01");

⚡ Quick Reference

Use caseMarkupNotes
Minimum quantity<input type="number" min="1">No zero orders
Slider floor<input type="range" min="0" max="100">Track bounds
Earliest date<input type="date" min="2026-01-01">ISO date string
Valid rangemin="1" max="100"Pair both attributes
Text minimumUse minlength, not minCharacter count
JS updateel.min = "10"String property

Applicable Elements

Element / typeSupported?Notes
<input type="number">YesMost common use
<input type="range">YesSlider lower bound
date, time, datetime-local, month, weekYesType-specific date/time strings
<meter>, <progress>YesScale lower bound
text, email, textareaNoUse minlength instead

min vs max vs minlength

AttributeApplies toLimits
minnumber, range, date/time inputs; meter, progressMinimum numeric or date/time value
maxSame input types; meter, progressMaximum numeric or date/time value
minlengthtext, search, url, tel, email, password, textareaMinimum character count (validation)

Examples Gallery

Number input floor, earliest date, and dynamic min on a range slider with JavaScript.

👀 Live Preview

Quantity field with min="1" and max="100":

Values below 1 fail browser constraint validation when the form is submitted or checkValidity() runs.

Example — Number Input Lower Limit

Ensure at least one item with min="1" on a quantity field:

number-min.html
<label for="quantity">Quantity:</label>

<input

  type="number"

  id="quantity"

  name="quantity"

  min="1"

  max="100"

  value="1">
Try It Yourself

How It Works

The browser compares the current value to min during constraint validation. Invalid values block form submission unless JavaScript bypasses checks—validate on the server too.

Example — Date Input Earliest Date

Block dates before a booking window opens:

date-min.html
<label for="startDate">Start date:</label>

<input type="date" id="startDate" min="2026-01-01">
Try It Yourself

How It Works

Date inputs interpret min as an ISO date string. Combine with max to define an allowed booking window.

Dynamic Values with JavaScript

Adjust the minimum at runtime when rules change:

dynamic-min.html
<input type="range" id="volume" min="0" max="100" value="50">



<script>

  document.getElementById("volume").min = "25";

</script>
Try It Yourself

How It Works

Assigning a string to input.min updates the lower bound immediately. If the current value is below the new min, bump it up or mark the field invalid. Re-validate after dynamic changes.

♿ Accessibility

  • Pair labels with inputs — Use <label for="id"> so users know what the min limit applies to.
  • Describe limits in help text — State the allowed range visibly (e.g. “1–100”) for screen reader users and sighted users alike.
  • Do not rely on color alone — Invalid states should include text or aria-invalid when you enhance validation with JavaScript.
  • Announce dynamic min changes — If JavaScript raises min, consider an aria-live region explaining the new floor.
  • Server validation for everyone — Client min alone can be bypassed; enforce limits on the server.

🧠 How min Works

1

Author sets min

Lower bound in markup.

Markup
2

User enters value

Type, pick, or slide.

Input
3

Browser validates

Value ≥ min required.

Check
=

Valid submission

Data within range.

Browser Support

The min attribute on supported input types and on <meter> and <progress> is fully supported in all modern browsers. Constraint validation behavior is consistent across Chrome, Firefox, Safari, and Edge.

HTML5 · Fully supported

Universal lower limits

All major browsers enforce min on number, range, and date/time inputs.

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
min on number, range, date/time inputs 99% supported

Bottom line: Safe to use on supported elements; validate minimums on the server too.

💡 Best Practices

✅ Do

  • Pair min with max for a clear valid range
  • Use min="1" on quantity fields that cannot be zero
  • Show the allowed range in labels or help text
  • Validate minimums again on the server
  • Adjust current value when raising min in JavaScript

❌ Don’t

  • Confuse min with minlength on text fields
  • Assume values must strictly exceed min (equal is valid)
  • Set min greater than max
  • Rely on client min alone for security or business rules
  • Forget type-specific formats for date and time mins

Conclusion

The min attribute is a practical way to set lower bounds on numeric, date, and time form values. Applied to the right input types and paired with max, it guides users toward valid data and catches out-of-range input before submission.

Remember that valid means greater than or equal to min, distinguish min from minlength, and always enforce limits on the server. Update input.min in JavaScript when business rules change at runtime.

Key Takeaways

Knowledge Unlocked

Five truths every developer should know about min

Bookmark these before building numeric forms.

5
Core concepts
📈 02

number & date

Supported types.

Scope
🔗 03

value ≥ min

Equal is valid.

Rule
📈 04

Pair with max

Define full range.

Compare
🔒 05

Server too

Client ≠ secure.

Security

❓ Frequently Asked Questions

It sets the minimum allowed value on number, range, date, time, and related input types, and the lower scale bound on meter and progress. Values below min fail constraint validation.
No. min limits numeric or date/time values. minlength limits the minimum number of characters in text fields and textarea.
Yes. A value equal to min is valid. The value must be greater than or equal to min, not strictly greater.
inputElement.min = "5" or setAttribute("min", "5") on HTMLInputElement.
Yes. Together they define an acceptable range, e.g. min="1" max="100". Ensure min is less than or equal to max.
No. Client-side min can be bypassed. Always validate minimum limits on the server before storing data.

Set lower limits with the min attribute

Practice number floors, earliest dates, and dynamic input.min in the Try It editor.

Try number input example →

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