HTML <search> Tag

The <search> element marks a container for search or filter UI — site search forms, page filters, or find bars — so assistive technology can jump to it as a search landmark.

Put controls such as <form> and <input type="search"> inside it. Do not use <search> to wrap the result list itself.

Baseline · Widely available.

Stable across browsers since about October 2023. Prefer it over <div role="search">.

Landmark note.

<search> already exposes the search role. Skip redundant role="search". Label multiple searches with title or aria-label.

HTML Syntax

syntax.html
<search> …controls…</search>

Both start and end tags are required. Content is flow content (often a form with a search input).

Attributes

<search> has no element-specific attributes. Use global attributes; these are the ones you will reach for most often:

AttributeDescriptionTry it
(none specific)No tag-only attributes — meaning comes from the element itselfTry it
title / aria-labelName the landmark when a page has more than one <search>Try it
class / idHooks for CSS and scriptingTry it

Global Attributes

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

Live Preview

Switch common <search> patterns. Forms use demo actions only.

A real <search> landmark. Pick a pattern, then Apply (or tap a chip).

Preview

Site search · form + type="search"

HTML Examples

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

Example 1 — Header Site Search

Wrap a submitting form in <search> inside the page header.

HTML
<header>
  <h1>Movie website</h1>
  <search>
    <form action="/search/" method="get">
      <label for="movie">Find a Movie</label>
      <input type="search" id="movie" name="q" />
      <button type="submit">Search</button>
    </form>
  </search>
</header>
Try It Yourself

How It Works

  1. Wrap the search UI in <search> so it becomes a search landmark.
  2. Use a real <form> when the query is submitted to a server.
  3. Prefer type="search" on the text field for clearer semantics and UA UI.
  4. Keep results outside this landmark (in <main> or similar).

Example 2 — Client-Side Filter Controls

When nothing is submitted, you can omit <form> but still mark the filter block.

HTML
<search>
  <label>
    Find and filter
    <input type="search" id="query" />
  </label>
  <label>
    <input type="checkbox" id="exact-only" />
    Exact matches only
  </label>
</search>

<!-- Results belong in main content, not inside <search> -->
<section aria-labelledby="results-heading">
  <h2 id="results-heading">Results</h2>
  <ul id="results"></ul>
</section>
Try It Yourself

How It Works

  1. Put filter controls in <search> so the landmark matches the purpose.
  2. Skip <form> if JavaScript handles filtering with no submit.
  3. Render result lists outside the search container.
  4. Ensure non-JS access when the same content must remain reachable without scripts.

Example 3 — Two Labeled <search>s

Site chrome and on-page filters are easier to tell apart when each landmark has a name.

HTML
<header>
  <h1>Car rental</h1>
  <search title="Website">
    <form action="/search/" method="get">
      <label for="site-q">Site search</label>
      <input type="search" id="site-q" name="q" />
      <button type="submit">Search</button>
    </form>
  </search>
</header>

<main>
  <search title="Cars">
    <h2>Filter cars</h2>
    <label for="car-q">Model</label>
    <input type="search" id="car-q" />
  </search>
  <!-- car results in main -->
</main>
Try It Yourself

How It Works

  1. Create separate <search> blocks for different purposes.
  2. Give each a unique title or aria-label.
  3. Keep each landmark focused on controls, not long result lists.
  4. Avoid wrapping the whole page in one giant search landmark.

Edge Cases & Pitfalls

results

Wrapping the result list

Results belong in main content. Nesting the whole result page inside <search> confuses the landmark’s purpose.

a11y

Unnamed multiple searches

Two unlabeled <search>s both announce as “search.” Add title or aria-label.

role

Redundant role="search"

<search> already maps to that role. Prefer the element over a styled <div>.

nav

search vs nav

Menus of links belong in <nav>. Search/filter controls belong in <search>.

input

type="search" alone is not enough

An input type marks the field, not a landmark. Wrap the search UI in <search> for the landmark.

js

Script-only search

Users without JavaScript still need a path to content. Prefer progressive enhancement when results matter.

Browser Support

The <search> element is core HTML in modern browsers. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<search>

Widely available since about October 2023. Chrome, Firefox, Safari, Edge, and Opera support it as a search landmark.

95% Global support (approx.)
Google Chrome 120+
Full support
Mozilla Firefox 118+
Full support
Apple Safari 17+
Full support
Microsoft Edge 120+
Full support
Opera 106+
Full support
Samsung Internet 24+
Full support
Internet Explorer —
Not supported
<search> Widely supported

Bottom line: Safe for modern sites. Prefer <search> over div role="search", and keep results out of the landmark.

Key Takeaways

  • Role: <search> marks search/filter UI as a landmark.
  • Pattern: often a <form> with type="search".
  • Results: keep the result list outside <search>.
  • Practice: label multiple searches; skip redundant roles.

One line: wrap search/filter controls in <search>, not the results.

Default CSS Settings

User-agent stylesheets typically treat <search> like other sectioning blocks:

default.css
search {
  display: block;
}

Layout (header bar, sidebar filter panel) comes from your CSS — not from the tag itself.

Frequently Asked Questions

The search element is a container for form controls or other content used to search or filter — site search, page filters, or app find bars. It exposes an implicit search landmark.
No. search supports only the global HTML attributes. Use title or aria-label when a page has more than one search landmark.
No. Present results in the main content. Quick suggestions that are part of the search UI may stay inside search; the result list itself usually should not.
Not if you use search. The element already has the implicit search role, so prefer the real tag over a div with role="search".
Yes when the query submits to a server. Pair search with form and input type="search". Pure client-side filters can omit form if nothing is submitted.
Yes — for example a site-wide header search and a page filter. Distinguish them with title or aria-label so landmarks stay clear.

Next: select

Continue with the HTML select tag tutorial.

select tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

10 people found this page helpful