Skip to the page
html reference · text

HTML <kbd> tag

closing tag
required
void element
no
lives inside
inline, inside running text
typically holds
a key name or short typed input

Where it goes

Around each key name or the typed text, inside a line.

Example

<p>Save with <kbd>Ctrl</kbd> + <kbd>S</kbd>, or type <kbd>:wq</kbd> and press <kbd>Enter</kbd>.</p>

Open this example in the editor →

Common mistakes

  • Using <code> for keys and shortcuts. It reads as source code to a screen reader (software that reads the page aloud). The key styling also has nowhere to attach.
  • Writing the + inside the <kbd>. "Ctrl + S" as one chunk means you cannot style the keys as keys. Put each key in its own <kbd>.
  • Using it for what the computer prints back. That is <samp>, not <kbd>.

Related

Updated 24 October 2026. Practice it in the html route, or read more on MDN.