HTML accesskey Attribute

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The accesskey global attribute hints a keyboard shortcut for the current element. Its value is usually a single printable character (including accented characters the keyboard can produce). The browser combines that character with platform modifiers (such as Alt or Control + Option).

You can put it on almost any HTML element — buttons, links, inputs, and more. Prefer predictable focus tools like tabindex and clear labels for everyday sites.

Baseline · Widely available.

Not deprecated and not experimental. Supported across modern browsers since about July 2015. Modifier keys still differ by browser and OS.

Accessibility caution.

Shortcuts often conflict with the browser, OS, or assistive technology. MDN generally advises not to use accesskey on most general-purpose websites and apps.

HTML Syntax

syntax.html
<element accesskey=" character">

The HTML living standard also allows a space-separated list of alternatives; the user agent may pick one that works on the device.

Attribute Values

What you can put in accesskey:

ValueDescriptionTry it
One characterA single printable key, e.g. s, 1, or an accented letterTry it
Letter matching the labelOften the first letter of the visible label (e.g. s for Search)Try it
Space-separated listAlternatives for the UA, e.g. s 0 (HTML living standard)Try it

Common activation (approximate)

BrowserWindows / LinuxmacOS
Chrome / EdgeAlt + keyControl + Option + key
FirefoxAlt + Shift + keyControl + Option + key
Safarin/aControl + Option + key

Exact shortcuts vary — always test on your target browsers.

Live Preview

Change the key on the button, then use your browser’s accesskey shortcut (see the table above). Focus the page first.

On Windows Chrome/Edge try Alt + key. On Firefox try Alt + Shift + key. On Mac try Control + Option + key.

Button

Press the accesskey for Stress reliever.

accesskey="s"

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor. Prefer these for learning — not as a default pattern for production sites.

Example 1 — Button with accesskey

MDN-style: hint the letter in the label.

HTML
<p>If you need to relax, press the <b>S</b>tress reliever!</p>
<button type="button" accesskey="s">Stress reliever</button>
Try It Yourself

How It Works

  1. Set one character. accesskey="s" hints the letter S.
  2. Browser adds modifiers. You usually press Alt (or Alt+Shift / Control+Option) plus S.
  3. Underline the letter in the text so users can discover the shortcut.
  4. Focus the page first — shortcuts may not fire if the wrong window is focused.

Example 3 — Alternative Keys (Living Standard)

Offer more than one candidate so the UA can pick a workable shortcut.

HTML
<label for="q">Search:</label>
<input type="search" id="q" name="q" accesskey="s 0">
Try It Yourself

How It Works

  1. Space-separated list. s 0 offers two candidates.
  2. UA chooses. A full keyboard might use S; a numeric pad might use 0.
  3. Focuses the control when the assigned shortcut runs.
  4. Still optional. Many sites skip accesskey and rely on Tab order instead.

Edge Cases & Pitfalls

Most problems are conflicts and discovery — not syntax.

a11y

Conflicts with OS and AT

A key that works in one browser/OS pair can break assistive technology or clash with browser chrome elsewhere.

i18n

Not every keyboard has your character

International layouts may lack the letter you chose. Prefer letters that exist for your audience — or avoid accesskey.

discovery

Users may not know shortcuts exist

Underline or document the key. Silent shortcuts cause accidental activation.

numbers

Numeric keys can confuse

Numbers without a clear meaning are harder for some users. Prefer letters tied to the control’s name when you must use accesskey.

prefer Tab

Tab order is usually enough

For most sites, logical focus order and tabindex (when needed) are safer than custom shortcuts.

Browser Support

accesskey is an HTML global attribute in the browser. It is not a Node.js, Deno, or Bun API. Modifier keys differ by engine and OS.

✓ Baseline · Widely available

accesskey

Widely available since about July 2015. Support for the attribute is broad; the exact key combination is browser- and platform-specific.

97% Attribute support
Google Chrome All modern · Alt+key (Win)
Full support
Mozilla Firefox All modern · Alt+Shift+key (Win)
Full support
Apple Safari Control+Option+key (Mac)
Full support
Microsoft Edge All modern · Alt+key (Win)
Full support
Opera All modern
Full support
Samsung Internet All modern
Full support
Internet Explorer Supported (legacy)
Supported
accesskey Widely supported

Bottom line: The attribute works widely. Treat activation shortcuts as inconsistent, and prefer not to rely on accesskey for critical UX.

Key Takeaways

  • Role: hint a keyboard shortcut for focus or activation.
  • Value: usually one printable character; lists are allowed by the living standard.
  • Modifiers differ by browser and OS — always test.
  • Use sparingly: MDN warns against accesskey for most general sites.

One line: accesskey hints a shortcut — learn it, test it, but rarely ship it by default.

Frequently Asked Questions

It is a global attribute that hints a keyboard shortcut for focusing or activating an element. The value is typically a single printable character.
It depends on the browser and OS. Common patterns include Alt + key (Windows Chrome/Edge), Alt + Shift + key (Firefox on Windows), and Control + Option + key (macOS).
Usually no. MDN advises against it for most general-purpose sites because shortcuts often conflict with the browser, OS, or assistive technology.
Authors usually set one character. The HTML living standard also allows a space-separated list of alternatives so the browser can pick a working key.
No. tabindex controls focus order. accesskey suggests a shortcut key combination.
Use element.accessKey for the attribute value, and element.accessKeyLabel for the browser’s assigned shortcut string when available.

Next: action

Set the URL that processes a form submission.

action tutorial →

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.

8 people found this page helpful