Home/HTML & Markdown/HTML Select Option Generator

HTML Select Option Generator

Turn a plain list into complete select markup — optgroups, placeholder, selected and disabled states — with presets for countries, states, months, currencies and time zones.

Free Browser-based No signup Copy-ready
Select Settings
Use value: Label to set both, or one word for both. Start a line with -- to open an optgroup.
Rendered as a disabled, selected, empty-value option so the browser's required validation still fires.
Options
Generated Markup
select.html

      

How it works

1

Paste a list or pick a preset

Use value: Label to control both, and -- to start an optgroup.

2

Configure the select

Name, id, placeholder, pre-selected value, disabled options, required and multiple.

3

Export

HTML, JSX, Vue, a JSON array or a JS render loop.

Small element, several easy mistakes

The <select> element is one of the few controls that works flawlessly across keyboard, touch and screen readers with no JavaScript at all. Most of the ways it goes wrong are in the details around it rather than the element itself.

The placeholder pattern

A first option that is disabled, selected and has value="" gives you a prompt the user cannot return to, while keeping required validation working. Give it a non-empty value and the browser thinks the field is already filled.

Values are what get submitted

The label is for humans, the value is for your backend. Use stable codes — GB, not United Kingdom — so renaming a label never breaks stored data.

When a select is the wrong control

  • Two or three options: radio buttons show every choice at once and take one click instead of two.
  • Over about fifty options: people cannot scan them. Use a searchable combobox, or an input with a datalist.
  • Multiple selection: native multiple requires ctrl-click, which most users never discover. A checkbox group is clearer.
  • Yes/no: a checkbox.
In React, never put selected on an option. It produces a console warning and does not behave as expected. Control the select with value and onChange on the <select> element — the JSX output here does this.

Frequently Asked Questions

View all FAQs
How do I create an HTML dropdown?
Use a <select> element containing one or more <option> elements.
What is the difference between option value and label?
The label is what the user sees. The value is what the form submits when that option is selected.
How do I preselect an option?
Add the Boolean selected attribute to the option that should be selected initially.
How do I disable one option?
Add the disabled attribute to that <option>.
Can I group options?
Yes. Use <optgroup label="..."> to group related options inside a select.
Does select support a placeholder attribute?
Not like a text input. A common pattern uses a disabled, selected option with an empty value as the prompt.
Should a select have a label?
Yes, a properly associated label is a strong default for usability and accessibility.

HTML Select Option Generator – Build Accessible Dropdown Markup

Use the HTML Select Option Generator above to turn a plain list into clean <select> and <option> markup.

Enter one option per line, give each item a separate value and visible label when needed, create <optgroup> sections, choose a preselected value, disable unavailable options and add a proper form label.

The tool can also create placeholders, required fields, multi-select controls and preset lists.

A dropdown is easy to make visually and easy to make incorrectly. The generated HTML should not only display choices; it should submit the right value, expose a useful accessible name and behave predictably during form validation.

What Is an HTML select Element?

The <select> element creates a form control containing a list of options.

A basic example is:

<select name="country" id="country">
  <option value="us">United States</option>
  <option value="ca">Canada</option>
</select>

Each <option> has:

  • a visible label
  • an optional submitted value
  • state such as selected or disabled

When the user submits the form, the selected option’s value is associated with the select control’s name.

If an option does not have an explicit value, its text content becomes the value.

In production forms, explicit values are often clearer because display text can change without changing the stored code.

How to Use This HTML Select Generator

Paste one option per line.

If the display label and submitted value should differ, use the tool’s value/label separator.

For example:

us: United States

can become:

<option value="us">United States</option>

Add a line beginning with the group marker when you want to create an <optgroup>.

Then configure:

  • name
  • id
  • placeholder
  • preselected value
  • disabled values
  • required behavior
  • multiple selection
  • sorting
  • automatic value generation

Choose whether the output should include the complete <select> wrapper or only the <option> elements.

Preview the form control before copying it.

Option value vs Visible Label

These two pieces of data have different jobs.

Example:

<option value="gb">United Kingdom</option>

The user sees:

United Kingdom

The form submits:

gb

This is useful when your backend stores a code while the interface shows a human-readable name.

Do not use unstable display text as a database key when a stable code exists.

For example, a country label may change for editorial reasons while an internal code should remain consistent.

The generator makes the distinction explicit so your output is not tied to whatever text happens to be visible.

What Does selected Do?

The Boolean selected attribute marks an option as initially selected.

Example:

<option value="monthly" selected>Monthly</option>

In a normal single-select control, only one option should be initially selected.

For a <select multiple>, multiple options can be selected.

Do not use selected merely to style an option.

It represents the control’s initial selection state.

If JavaScript later changes the current selection, the live state can differ from the original HTML attribute.

For server-rendered forms, generate the appropriate selected option from the data model.

What Does disabled Do?

A disabled option cannot be selected normally.

Example:

<option value="sold-out" disabled>Sold out</option>

This is useful when you want users to see that an option exists but is unavailable.

An entire <optgroup> can also be disabled.

Do not use disabled options as the only explanation for why something is unavailable if the reason matters.

A label such as:

Premium — unavailable on current plan

is clearer than a mysterious grey item.

The disabled state affects interaction; the text should still communicate meaning.

Create a Placeholder Option

HTML <select> does not have a true placeholder attribute like a text input.

A common pattern is an option with an empty value:

<option value="" disabled selected>Please choose…</option>

Combined with a required single-select control, this can prompt the user to choose a real value.

The placeholder is still an <option>.

It is not a substitute for a label.

The user needs to know what the field means even after a value is selected and the placeholder is no longer visible.

Use a <label> for the field name.

Use the placeholder as selection guidance.

Why a label Matters

A form control should have an accessible name.

An explicit HTML label can connect to a select using matching for and id values.

Example:

<label for="department">Department</label>
<select id="department" name="department">...</select>

This relationship helps screen readers identify the purpose of the field.

It also increases the clickable area because selecting the label can focus the associated control.

Placeholder text alone is not a label.

A visible label remains available after the user makes a choice.

For accessibility and usability, include one unless the control already has another robust accessible-name mechanism.

name and id Are Different

These attributes often contain similar text but serve different purposes.

id identifies the element in the HTML document.

It is used by:

  • <label for="...">
  • JavaScript
  • CSS selectors
  • fragment references

name identifies the field during form submission.

A select without a name normally does not contribute a named value to standard form submission.

A select without an id can still submit data, but an explicit external <label> cannot point to it with for.

Set both intentionally.

What Does required Do on a Select?

The required attribute participates in browser form validation.

For a typical single-select placeholder pattern, the control starts with an empty value.

If the select is required, the user must choose a valid non-empty option before normal form submission succeeds.

This is why the generator’s placeholder can use:

  • empty value
  • disabled
  • selected

along with required on the <select>.

Client-side required validation improves the interface, but it does not replace server-side validation.

A user can bypass browser controls or send a request directly.

Validate submitted values on the server too.

What Is optgroup?

<optgroup> groups related options inside a select.

Example:

<optgroup label="Fruit">
  <option value="apple">Apple</option>
  <option value="banana">Banana</option>
</optgroup>

This is useful when one dropdown contains several categories.

Examples include:

  • countries by region
  • products by category
  • departments by division
  • vehicles by type

Groups improve scanning, but they do not create arbitrary nested menus.

An <optgroup> contains options, not another optgroup hierarchy.

If the choice structure requires deep nesting, reconsider whether one select is the right control.

Multiple Select

The multiple attribute allows more than one option to be selected.

Example:

<select name="skills" multiple>

The browser presents the control differently from a normal single dropdown.

Users may need keyboard modifiers or platform-specific interactions to choose several items.

For complex multi-selection interfaces, usability testing matters.

Also ensure the server can receive multiple submitted values.

Frameworks differ in how they name and parse multi-valued form controls.

The HTML option generator can create the markup, but your application must handle the submitted collection correctly.

Select vs Datalist

A <select> restricts the user to the available options.

A <datalist> provides suggestions to an associated input while normally still allowing free text.

Use select when the submitted value must come from a known set.

Use datalist when suggestions are helpful but other values remain valid.

This distinction is important.

A country field tied to a fixed database code may need select.

A search box suggesting previous queries may be better suited to datalist.

Use the HTML Data List Generator for the second pattern.

Common HTML Select Mistakes

Avoid these problems:

  • using a placeholder instead of a real label
  • forgetting the name attribute
  • storing visible labels when stable codes are required
  • sorting options that have a meaningful natural order
  • using disabled when you expect a value to submit normally
  • assuming browser required validation replaces server validation
  • selecting several options in a normal single-select
  • using a giant dropdown for a choice set that needs search
  • auto-generating values that later become unstable API identifiers
  • choosing select when free-form input should remain allowed

A good dropdown reduces the user’s decision effort without hiding what the field means.

Related searches

html select option generatorselect dropdown generatoroptgroup html exampleselect option value vs labelhtml select placeholderselect required attributeselect multiple attributeselect vs datalistdisabled option htmlselect label for idhtml form dropdown markuppreselected option html