Codectionary / Developer documentation / HTML

<search>

The <search> element is a relatively new HTML5 semantic element that identifies a section of the page containing search or filtering controls — either for the site itself or for the current page's content. It gives assistive technology a reliable landmark to jump straight to search functionality.

Syntax

<search>
  <form role="search">
    <input type="search" name="q">
  </form>
</search>

Examples

Site Search

Wrapping a site-wide search form.

<search>
  <form action="/search" method="get">
    <label for="q">Search Codectionary</label>
    <input type="search" id="q" name="q" placeholder="Search docs...">
    <button type="submit">Search</button>
  </form>
</search>

Filter Controls

Using search to wrap filtering controls for a list of results.

<search>
  <label for="filter">Filter by language:</label>
  <select id="filter">
    <option>All</option>
    <option>HTML</option>
    <option>CSS</option>
  </select>
</search>

Header Search Bar

A compact search bar placed in the site header.

<header>
  <search>
    <input type="search" placeholder="Quick search..." style="padding: 6px 12px; border-radius: 6px; border: 1px solid #d1d5db;">
  </search>
</header>

Best practices

  • Use search to wrap the form and controls for search/filter functionality, not the results themselves
  • It can be used for both site-wide search and in-page filtering — both are valid uses
  • Being a newer element, verify support in your target browsers; it degrades gracefully to an unstyled generic container in older ones
  • Continue using a real form inside it for the actual search input — search is a landmark wrapper, not a replacement for form semantics

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

<search>

Desktop

Chrome
Supported
From 118
Firefox
Supported
From 118
Safari
Supported
From 17
Edge
Supported
From 118
Opera
Supported
From 104

Mobile

Safari on iOS
Supported
From 17
Chrome for Android
Supported
From 118
Firefox for Android
Supported
From 118
Samsung Internet
Supported
From 25.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 118

Firefox

  • From 118

Safari

  • From 17

Edge

  • From 118

Opera

  • From 104

Safari on iOS

  • From 17

Chrome for Android

  • From 118

Firefox for Android

  • From 118

Samsung Internet

  • From 25.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading