Skip to content

Dropdown Generator

Presets One click to load a look, then fine-tune it

Type of field
Label and name

One checkbox uses its option text (under Options) as its label. This text only sets the id and name.

Leave id and name empty and they're made from the label.

Options

The value is what the form sends. Leave it empty and it's made from the text.

    Settings
    Layout
    Size
    Width
    Checkbox look

    The browser draws the boxes, and accent-color paints them when they're ticked.

    Border and corners
    Border on
    Colors
    Page

    Open the dropdown, or Tab to it and use the arrow keys.

    <style>
      .dropdown-label {
        display: block;
        margin-bottom: 6px;
        font-weight: 600;
      }
    
      .dropdown {
        box-sizing: border-box;
        display: block;
        width: 320px;
        max-width: 100%;
        padding: 10px 36px 10px 12px;
        font-family: inherit;
        font-size: 16px;
        line-height: 1.4;
        color: #111827;
        background-color: #ffffff;
        border: 1px solid #6b7280;
        border-radius: 6px;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 12px 8px;
        cursor: pointer;
      }
    
      .dropdown:focus {
        outline: 2px solid transparent;
        outline-offset: 2px;
        border-color: #4f46e5;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
      }
    </style>
    
    <label for="country" class="dropdown-label">Country</label>
    <select id="country" name="country" class="dropdown">
      <option value="" disabled selected hidden>Choose a country…</option>
      <option value="united-states">United States</option>
      <option value="canada">Canada</option>
      <option value="united-kingdom">United Kingdom</option>
      <option value="australia">Australia</option>
      <option value="india">India</option>
      <option value="germany">Germany</option>
    </select>
    • Put the <style> block in your page's <head> (or the CSS in your stylesheet), and the HTML inside your <form>.
    • CSS can style the closed box, but the list that opens is drawn by the browser and the system, so it looks a bit different everywhere.

    HTML Dropdown Generator: Select, Checkbox and Radio Button Code

    What Is an HTML Dropdown?

    A dropdown is the box you click to open a list and pick one thing, like your country on a checkout page. In HTML it's a <select> with an <option> for each choice. Its cousins do the same job in a different way: checkboxes let people tick any number of choices, radio buttons let them pick exactly one with every choice in view, and a datalist adds suggestions to a normal text box.

    This generator writes all five for you. Pick the type, type your options (or paste a whole list), choose a look, and try the real thing in the preview: open the dropdown, tick the boxes, use the keyboard. Then copy clean HTML and CSS with labels, a proper placeholder and a <fieldset> where it belongs. It all runs in your browser, and your last field is remembered for next time.

    How to Use It, Step by Step

    Five quick steps. The preview is the exact code you copy, so what you see is what you get.

    Step 1 Pick the Type of Field

    Choose Dropdown, Multi-select, Checkboxes, Radio buttons or Suggestions (a text box with a datalist). Each one starts with a small example list. If you haven't changed the list yet, it switches to match, so Radio buttons start with shirt sizes and Checkboxes with pizza toppings.

    Step 2 Write Your Options

    • Text is what people see. Value is what the form sends. Leave the value empty and it's made from the text (“United States” becomes united-states).
    • Tick Selected or Checked to pick a default, and Disabled for a choice that's shown but can't be picked.
    • For dropdowns, type a Group name to put options under an <optgroup> heading.
    • Move options with ↑ and ↓, remove them with ✕, or click Paste a list and drop in one option per line (two columns from a spreadsheet work too).

    Step 3 Set the Label and Settings

    Type the Label (for checkboxes and radios, it becomes the <legend>), and a Placeholder option like “Choose a country…” for a dropdown. The id and name are made from the label, or you can type your own. Then switch on Required or Disabled, and for checkboxes and radios pick Stacked or In a row.

    Step 4 Choose a Look

    Click a Preset (Simple, Rounded, Pill, Underline, Dark, Big touch-friendly, Custom checkboxes or Toggle switch), then fine-tune the width, font size, padding, border, corners and colors. Dropdowns can get their own arrow. Checkboxes and radios can keep the browser's look with your color, get a fully custom look, or become an on/off switch. Every look keeps a clear focus ring for keyboard users.

    Step 5 Try It, Then Copy the Code

    Use the field in the preview, and switch the page behind it to white, gray or dark. Then pick Class + <style> (a reusable class, best for most sites) or Inline styles, and press Copy all, Copy HTML or Copy CSS. The notes under the code point out anything worth knowing, like a dropdown with only two options or radios without a default.

    💡 Inline styles can't do :focus, :checked or ::before, so with inline output the focus ring and the custom checkbox look are left out. The tool tells you when that happens.

    How to Make a Dropdown in HTML

    A dropdown is a <select> with <option> elements inside. The text between the option tags is what people see. The value is what the form sends, so it can be short and simple while the text stays friendly. selected picks the option that shows first; without it, the first option is picked. Give the select a <label> whose for matches its id.

    The code:

    <label for="fruit">Favorite fruit</label>
    <select id="fruit" name="fruit">
      <option value="apple">Apple</option>
      <option value="banana" selected>Banana</option>
      <option value="cherry">Cherry</option>
    </select>

    You'll see (open it):

    Leave out value and the browser sends the option's text instead. That works, but an explicit value means you can change the wording later without breaking the code that reads the form.

    Group Options With optgroup

    Long lists are easier to scan in groups. Wrap options in <optgroup label="...">: the label shows as a bold heading that can't be picked. Groups can't be nested, so keep it to one level.

    The code:

    <label for="car">Car</label>
    <select id="car" name="car">
      <optgroup label="Electric">
        <option value="model-3">Model 3</option>
        <option value="leaf">Leaf</option>
      </optgroup>
      <optgroup label="Petrol">
        <option value="golf">Golf</option>
        <option value="civic">Civic</option>
      </optgroup>
    </select>

    You'll see (open it):

    A “Choose…” Placeholder That Works With required

    A dropdown always has something picked, so required on its own does nothing: the first option counts as an answer. The fix is a first option with an empty value. The browser treats it as a placeholder, and with required it won't send the form until someone picks a real option. disabled stops people from picking it on purpose, hidden keeps it out of the open list, and selected makes it show first.

    The code:

    <label for="size">Size</label>
    <select id="size" name="size" required>
      <option value="" disabled selected hidden>Choose a size…</option>
      <option value="s">Small</option>
      <option value="m">Medium</option>
      <option value="l">Large</option>
    </select>

    You'll see:

    The placeholder has to be the very first option and must not sit inside an <optgroup>. If another option is selected, that one shows instead and the placeholder never appears.

    Multi-Select Dropdown

    Add multiple and the dropdown becomes a list where people can pick more than one option. size sets how many rows show at once. On a computer, people hold Ctrl (Cmd on a Mac) and click to pick more, and plenty of them don't know that. Phones handle it better and show a list with ticks.

    The code:

    <label for="days">Days you can work</label>
    <select id="days" name="days" multiple size="4">
      <option value="mon">Monday</option>
      <option value="tue" selected>Tuesday</option>
      <option value="wed">Wednesday</option>
      <option value="thu" selected>Thursday</option>
      <option value="fri">Friday</option>
    </select>

    You'll see (Ctrl+click to pick more):

    💡 For a handful of choices, a group of checkboxes is usually friendlier than a multi-select. Switch the generator to Checkboxes and your options come along.

    Checkboxes vs Radio Buttons: Which One to Use

    Both show every choice at once. The difference is how many answers are allowed. Radio buttons in the same group (the same name) allow exactly one: picking one unticks the others. Checkboxes allow any number, including none. Here's a quick way to choose:

    You want Use Why
    One answer from 2 to about 7 choices Radio buttons Every choice is visible, and it takes one click.
    One answer from a long list (countries, years) Dropdown (<select>) Takes one line of space and has type-to-jump built in.
    Any number of answers, including none Checkboxes Each box is ticked on its own; nothing to hold down.
    A single yes or no ("I agree") One checkbox (or a switch) A lone radio button can never be unticked.
    Many answers from a long list Checkboxes in a scrolling box, or a multi-select Multi-selects need Ctrl+click, which many people miss.
    Free typing, with a few common answers Text box + <datalist> Suggests answers but still allows anything.

    Group Checkboxes and Radios With fieldset and legend

    Each checkbox or radio has its own label, like “Express (next day)”. But what's the question? That's the job of <fieldset> and <legend>: the fieldset wraps the group, and the legend is its title. Screen readers read the legend when someone enters the group, so they hear “Delivery, Standard, radio button, 1 of 2”. The generator adds a fieldset by default and removes the browser's gray border, so it doesn't change how your page looks.

    The code:

    <fieldset>
      <legend>Delivery</legend>
      <input type="radio" id="standard" name="delivery" value="standard" checked>
      <label for="standard">Standard (3 to 5 days)</label><br>
      <input type="radio" id="express" name="delivery" value="express">
      <label for="express">Express (next day)</label>
    </fieldset>
    
    <fieldset>
      <legend>Extras</legend>
      <input type="checkbox" id="gift" name="extras" value="gift">
      <label for="gift">Gift wrap</label><br>
      <input type="checkbox" id="card" name="extras" value="card">
      <label for="card">Add a card</label>
    </fieldset>

    You'll see (the browser's default fieldset border):

    Notice that both radios share name="delivery", while each input has its own id for its label. Clicking the label text ticks the box too, which makes it a much bigger target on a phone.

    A Text Box With Suggestions: datalist

    Sometimes you want to suggest answers without limiting them. Connect an <input> to a <datalist> with the list attribute, and the browser offers the options as people type. They can still type anything else. Each browser shows the list its own way, and you can't style it.

    The code:

    <label for="city">City</label>
    <input type="text" id="city" name="city" list="city-list" autocomplete="off">
    <datalist id="city-list">
      <option value="Amsterdam"></option>
      <option value="Berlin"></option>
      <option value="Lisbon"></option>
      <option value="London"></option>
    </datalist>

    You'll see (click and type “L”):

    Style a Select Dropdown With CSS

    The closed box takes normal CSS: width, padding, border, border-radius, colors and font. To swap the browser's arrow for your own, add appearance: none (it removes the arrow), draw a new one as a background-image, and leave some padding on the right so long text doesn't run under it. The generator writes the arrow as a tiny SVG in the CSS, in the color you pick.

    The code:

    <style>
      .nice-select {
        -webkit-appearance: none;
        appearance: none;
        width: 240px;
        padding: 10px 36px 10px 12px;
        font: inherit;
        border: 2px solid #9ca3af;
        border-radius: 10px;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px;
      }
      .nice-select:focus {
        outline: 2px solid transparent;
        border-color: #4f46e5;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
      }
    </style>
    <select class="nice-select" aria-label="Plan">
      <option>Free</option>
      <option>Pro</option>
      <option>Team</option>
    </select>

    You'll see (click or Tab to it):

    To be honest about the limits: the list that opens is drawn by the browser and the operating system, so CSS can't fully style it, and it looks a little different on Windows, Mac, Android and iPhone. Newer Chrome and Edge let you style the open list with appearance: base-select; other browsers ignore it and show a normal dropdown. If you need pictures or rich content inside the list, that's a custom JavaScript menu, not a <select>.

    Style Checkboxes and Radio Buttons

    The one-line fix is accent-color. It paints the tick and the radio dot in your color, and it works in all modern browsers. width and height make the boxes bigger.

    The code:

    <style>
      .green {
        accent-color: #16a34a;
        width: 18px;
        height: 18px;
      }
    </style>
    <input type="checkbox" id="news" class="green" checked>
    <label for="news">Send me the newsletter</label><br>
    <input type="radio" id="yes" name="ok" class="green" checked>
    <label for="yes">Yes</label>
    <input type="radio" id="no" name="ok" class="green">
    <label for="no">No</label>

    You'll see:

    For your own look, set appearance: none on the input and draw it with CSS: a border for the box, a ::before for the tick, and :checked for the ticked state. Because it's still the real <input>, the keyboard, screen readers and form sending all keep working. Avoid the old trick of hiding the input and styling a <span>: it's easy to lose the focus ring that way.

    The code:

    <style>
      .box {
        -webkit-appearance: none;
        appearance: none;
        display: inline-grid;
        place-content: center;
        width: 20px;
        height: 20px;
        margin: 0 6px 0 0;
        vertical-align: middle;
        border: 2px solid #6b7280;
        border-radius: 5px;
        cursor: pointer;
      }
      .box::before {
        content: "";
        width: 12px;
        height: 12px;
        background: #fff;
        clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
        transform: scale(0);
      }
      .box:checked {
        background: #4f46e5;
        border-color: #4f46e5;
      }
      .box:checked::before {
        transform: scale(1);
      }
      .box:focus-visible {
        outline: 2px solid #4f46e5;
        outline-offset: 2px;
      }
    </style>
    <input type="checkbox" id="terms" class="box" checked>
    <label for="terms">I agree to the terms</label>

    You'll see (click it, or Tab and press Space):

    The toggle switch preset works the same way: a real checkbox shaped like a switch, with role="switch" so screen readers say “on” and “off”.

    Getting the Value in a Form

    When a form is sent, each field becomes a name=value pair. A dropdown sends the value of the picked option, like country=canada. Radio buttons send the value of the ticked one. Checkboxes send one pair for every ticked box (extras=gift&extras=card) and nothing at all when none are ticked, so treat “missing” as “no” on your server. Disabled fields aren't sent.

    Accessibility Checklist

    Common Mistakes

    What This Generator Doesn't Do

    Building the rest of the form? Make the text fields with the HTML Text Box Generator, the submit button with the HTML Button Generator, look up any element in the HTML Tags reference, and check your page with the HTML Validator.

    Frequently Asked Questions

    How do I make a dropdown list in HTML?

    Use a select element with one option element per choice: <select id="country" name="country"><option value="ca">Canada</option><option value="us">United States</option></select>. The text between the option tags is what people see, and value is what the form sends. Put a <label for="country">Country</label> in front of it so people (and screen readers) know what it is for.

    How do I set the default selected option?

    Add the selected attribute to that option: <option value="medium" selected>Medium</option>. A normal dropdown can only have one selected option; if several have it, the browser picks the last one. For checkboxes and radio buttons the attribute is called checked instead.

    How do I add a "Choose an option" placeholder to a dropdown?

    Make it the first option with an empty value: <option value="" disabled selected hidden>Choose…</option>. The empty value is the important part: with required on the select, the browser won't send the form until someone picks a real option. disabled and hidden keep the placeholder from being picked again. Some browsers still show it in the list, grayed out, which is fine.

    When should I use checkboxes and when radio buttons?

    Radio buttons are for one answer from a few choices (a shirt size, a delivery speed): picking one unticks the others. Checkboxes are for any number of answers (pizza toppings), including none, and a single checkbox is a yes or no (like "I agree"). With more than about seven choices, a dropdown takes less space than radio buttons.

    Why can I tick more than one of my radio buttons?

    Radio buttons only work as a group when they share the same name attribute: name="size" on every one of them. If the names differ (or are missing), each radio is its own group and you can tick them all. Each one still needs its own id so its label can point to it.

    How do I style a select dropdown with CSS?

    The closed box takes normal CSS: width, padding, border, border-radius, colors and font. To replace the browser's arrow, add appearance: none and draw your own with a background-image (the generator uses a small SVG) plus some padding on the right. The list that opens is drawn by the browser and the system, so you can't fully style it. Newer Chrome and Edge let you style it with appearance: base-select, and other browsers ignore that and show a normal dropdown.

    How do I change the color of a checkbox or radio button?

    The quick way is accent-color: input[type="checkbox"] { accent-color: #16a34a; }. It colors the ticked box and the radio dot in all modern browsers. For a fully custom look, set appearance: none on the input and draw the box, the tick and the checked state with CSS. That keeps the real input, so the keyboard, screen readers and form sending still work.

    How do I let people pick more than one option?

    Add multiple to the select (<select name="languages" multiple size="5">), and people hold Ctrl (Cmd on a Mac) to pick more. Many people don't know that, so a group of checkboxes is usually easier. Either way the form sends one name=value pair for each picked option; PHP needs the name to end in [] (name="languages[]") to keep them all.

    How do I group options inside a dropdown?

    Wrap them in optgroup elements with a label: <optgroup label="Europe"><option>France</option><option>Germany</option></optgroup>. The group label shows in bold and can't be picked. Groups can't be nested, so keep it to one level. In the generator, type the same group name on the options that belong together.