HTML <option> Tag

Beginner
6 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <option> element defines one choice in a <select>, an <optgroup>, or a <datalist>.

Pair the list with a <label>. Use value for the data you submit, selected for the default choice, and disabled for unavailable items.

Baseline · Widely available.

Core <option> support has been stable across browsers since about July 2015 (and much earlier in practice).

Deprecated · Obsolete attribute.

Do not use name on <option>. Put name on the <select> instead.

HTML Syntax

syntax.html
<option value=" data">label</option>

The start tag is required. The end tag may be omitted in some cases, but writing both tags is clearer for beginners. In a classic <select>, option content is text only.

Attributes

The attributes you will use most often on <option>:

AttributeDescriptionTry it
valueValue submitted when this option is chosen (defaults to the text content)Try it
selectedBoolean — option is selected when the page loadsTry it
disabledBoolean — option cannot be selectedTry it
labelOptional display label; if omitted, the element text is usedTry it

Global Attributes

The <option> tag also supports the Global Attributes in HTML.

Live Preview

Pick a pet. The note shows the selected option’s value.

A real <select> with <option> children. Disabled options cannot be chosen.

Selection

Selected value: cat

HTML Examples

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

Example 1 — Basic <option> List

Each option is one choice inside a labeled select.

HTML
<label for="pet">Choose a pet:</label>
<select id="pet" name="pet">
  <option value="">--Please choose--</option>
  <option value="dog">Dog</option>
  <option value="cat">Cat</option>
  <option value="hamster">Hamster</option>
</select>
Try It Yourself

How It Works

  1. Label the control with matching for / id.
  2. Open <select> and give it a name for form data.
  3. Add one <option> per choice with a value.
  4. Use an empty first option when you want users to pick deliberately.

Example 2 — value vs Visible Text

Users see friendly labels; the form can submit short codes.

HTML
<label for="size">T-shirt size:</label>
<select id="size" name="size">
  <option value="s">Small</option>
  <option value="m">Medium</option>
  <option value="l">Large</option>
</select>
Try It Yourself

How It Works

  1. Put human text between the option tags.
  2. Set value to the machine-friendly code you want on the server.
  3. If you omit value, the visible text is submitted instead.
  4. Keep values unique within the same select when each choice must be distinct.

Example 3 — selected and disabled

Pre-select a default and block unavailable choices.

HTML
<label for="plan">Plan:</label>
<select id="plan" name="plan">
  <option value="free">Free</option>
  <option value="pro" selected>Pro</option>
  <option value="team" disabled>Team (coming soon)</option>
</select>
Try It Yourself

How It Works

  1. Add selected on the option that should load as the default.
  2. In a single select, mark only one option as selected.
  3. Add disabled so that choice cannot be picked.
  4. Explain why in the option text when an item is unavailable.

Example 4 — Options Inside <optgroup>

Group related options under a shared label.

HTML
<label for="fruit">Fruit:</label>
<select id="fruit" name="fruit">
  <optgroup label="Citrus">
    <option value="orange">Orange</option>
    <option value="lemon">Lemon</option>
  </optgroup>
  <optgroup label="Berries">
    <option value="strawberry">Strawberry</option>
    <option value="blueberry">Blueberry</option>
  </optgroup>
</select>
Try It Yourself

How It Works

  1. Wrap related options in <optgroup>.
  2. Set the group label — it is a heading, not a selectable value.
  3. Keep real choices as <option> inside each group.
  4. Still name the <select> so the chosen option value is submitted.

Edge Cases & Pitfalls

Most option bugs are missing values, missing labels, or orphan options outside a select.

structure

Needs a parent list

<option> belongs in <select>, <optgroup>, or <datalist> — not alone in the body.

forms

name goes on select

Do not put obsolete name on option. The select’s name plus the option’s value make the submitted pair.

selected

One selected (usually)

Without multiple on select, only one option should have selected.

a11y

Label the select

Associate a visible <label> with the select. Placeholder-style first options are not a full label substitute.

style

Limited option CSS

Styling option menus is historically limited and OS-dependent. Prefer clear text over fancy option colors.

Browser Support

The <option> element is core HTML form UI in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<option>

Widely available since about July 2015 (and long before). Chrome, Firefox, Safari, Edge, and Opera fully support option in select, optgroup, and datalist.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<option> Widely supported

Bottom line: Safe everywhere for classic select lists. Always label the select and give options clear values.

Key Takeaways

  • Role: <option> is one selectable item in a list control.
  • Submit: value on the option + name on the select.
  • Defaults: selected for the starting choice; disabled to block one.
  • Access: always label the parent <select>.

One line: each <option> is a labeled choice whose value rides with the select’s name.

Default CSS Settings

Option appearance is largely controlled by the OS and browser. A simple idea of the element:

default.css
option {
  /* display and colors are often OS-native */
}

Prefer readable labels over heavy option styling. Focus styles belong on the select control.

Frequently Asked Questions

The option element defines one choice inside a select dropdown, an optgroup group, or a datalist. The selected option’s value is what gets submitted with the form.
As a child of select, optgroup (inside select), or datalist. Do not place option alone in the page body.
The submitted value becomes the option’s text content. Prefer an explicit value when the code you send should differ from the label users see.
In a normal select, only one option may have selected. With select multiple, several options can be selected at once.
A disabled option cannot be chosen. Browsers usually gray it out. An option can also be unusable if its parent optgroup is disabled.
No. name on option is obsolete. Put name on the select (or use the form control’s name), and use id when you need an element identifier.

Next: output

Learn the element used to show calculation or script results in a form.

output 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.

14 people found this page helpful