# `<search>`

> The `<search>` HTML element is a container for a search or filtering form and its related controls.

## What is the HTML `<search>` element and when should I use it?

The element that represents a container for controls and content related to search or filtering purposes and can be used in various contexts, including the current webpage, a website or a document.

- Topic: Semantics
- Type: tag
- Browser support: Chrome 118+, Chrome Android 118+, Edge 118+, Firefox 118+, Firefox Android 118+, Safari 17+, Safari iOS 17+

## Example

Wrong:

```html
<div class="search">
  <form action="/find">
    <input name="q">
  </form>
</div>
```

Right:

```html
<search>
  <form action="/find">
    <label for="q">Search</label>
    <input id="q" type="search" name="q">
  </form>
</search>
```

`<search>` exposes a search landmark, and the label gives the input an accessible name.

## Common mistakes

- Putting search results inside `<search>` along with the form.
- Still adding `role="search"` to a `<search>` element.

## Key points

- `<search>` wraps the search or filter form, not the search results.
- The search input has a visible `<label>` or an accessible name.
- The input uses `type="search"` inside the form.

## Interview questions

### Is `<search>` the same as `<input type="search">`?

No. `<search>` is a container landmark for the whole search area, while `<input type="search">` is the text field.

### What did people use before the `<search>` element?

A `<form role="search">` or `<div role="search">`, which still works as a fallback.

## Related cards

- [search](https://wonderium.dev/a11y/search.md)
- [searchbox](https://wonderium.dev/a11y/searchbox.md)
- [`<form>`](https://wonderium.dev/html/form.md)
- [`<input>`](https://wonderium.dev/html/input.md)

---

- Level: [HTML](https://wonderium.dev/html.md)
- HTML version: https://wonderium.dev/html/search
- Last updated: 2026-11-25
