HTML accesskey Attribute Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The HTML accesskey attribute defines a keyboard shortcut to activate or focus an element.It assigns a keyboard key combination to trigger an element (like a link or button).Browser support and specific key combinations vary (e.g., Alt + key on Windows, Ctrl + key on macOS).Use it sparingly and provide clear visual cues for accessibility.Syntax<element accesskey = "single_character"> HTML <!DOCTYPE html> <html> <body> <a href="https://www.example.com/" accesskey="e">Example Link (Alt + e)\ </a> <button accesskey="s">Submit (Alt + s)</button> </body> </html> accesskey sets a keyboard shortcut (e.g., Alt + key).Text in parentheses shows the shortcut to users.Shortcut to use accesskeyThe table describes the shortcut to use Accesskeyy:BrowserWindowsMacLinuxGoogle ChromeAlt + single_characterCommand + Alt + single_characterAlt + single_characterMozilla FirefoxAlt + Shift + single_characterCommand + Alt + single_characterAlt + Shift + single_characterInternet ExplorerAlt + single_characterN/AN/ASafariAlt + single_characterCommand + Alt + single_characterN/AOperaAlt + single_characterCommand + Alt + single_characterAlt + single_characterNote: In HTML4.1, the accesskey attributes can be used with only a few elements which include <a>, <area>, <button>, <input>, <label>, <legend>, and <textarea>.In HTML5, the accesskey attribute can be used with any element.The behavior of the browser differs when dealing with more than one element having the same accesskey:Google Chrome and Safari: The last element with the accesskey will be activatedOpera: The first element with the accesskey will be activatedInternet Explorer and Mozilla Firefox: The next element with the accesskey will be activatedMore Examples of HTML accesskey AttributeAssigning Access Keys to Navigation Links html <html> <body> <nav> <a href="#home" accesskey="h">Home</a> <a href="#about" accesskey="a">About</a> <a href="#contact" accesskey="c">Contact</a> </nav> </body> </html> Pressing Alt + h (Windows/Linux) or Control + Option + h (Mac) will navigate to the "Home" section.Pressing Alt + a or Control + Option + a will navigate to the "About" section.Pressing Alt + c or Control + Option + c will navigate to the "Contact" section.Assigning Access Keys to Form Controls HTML <html> <body> <form> <label for="username" accesskey="u">Username:</label> <input type="text" id="username" name="username"><br><br> <label for="password" accesskey="p">Password:</label> <input type="password" id="password" name="password"><br><br> <button type="submit" accesskey="s">Submit</button> </form> </body> </html> Pressing Alt + u (Windows/Linux) or Control + Option + u (Mac) focuses on the "Username" input field.Pressing Alt + p or Control + Option + p focuses on the "Password" input field.Pressing Alt + s or Control + Option + s activates the "Submit" button.Best Practices for Using the accesskey AttributeAvoid Conflicts: Ensure assigned access keys do not interfere with existing browser or assistive technology shortcuts, as this can hinder accessibility. Inform Users: Clearly indicate the availability of access keys within the user interface, enabling users to utilize them effectively. Use Sparingly: Apply access keys only to frequently used interactive elements to prevent overwhelming users and potential conflicts Comment More infoAdvertise with us I IshitaNegi Follow Improve Article Tags : Web Technologies HTML HTML-Attributes Explore HTML Tutorial 11 min read BasicsHTML Introduction 5 min read HTML Editors 5 min read HTML Basics 7 min read HTML Structure & ElementsHTML Elements 5 min read HTML Attributes 8 min read HTML Headings 4 min read HTML Paragraphs 5 min read HTML Text Formatting 4 min read HTML Block and Inline Elements 3 min read HTML Charsets 4 min read HTML ListHTML Lists 5 min read HTML Ordered Lists 5 min read HTML Unordered Lists 4 min read HTML Description Lists 3 min read HTML Visuals & MediaHTML Colors 11 min read HTML Links Hyperlinks 3 min read HTML Images 7 min read HTML Favicon 4 min read HTML Video 4 min read HTML Layout & DesignHTML Tables 10 min read HTML Iframes 4 min read HTML Layout 4 min read HTML File Paths 3 min read HTML Projects& Advanced TopicsHTML Forms 5 min read HTML5 Semantics 6 min read HTML URL Encoding 4 min read HTML Responsive Web Design 11 min read Top 10 Projects For Beginners To Practice HTML and CSS Skills 8 min read HTML Tutorial ReferencesHTML Tags - A to Z List 15+ min read HTML Attributes Complete Reference 8 min read HTML Global Attributes 5 min read HTML5 Complete Reference 8 min read HTML5 MathML Complete Reference 3 min read HTML DOM Complete Reference 15+ min read HTML DOM Audio/Video Complete Reference 2 min read SVG Element Complete Reference 5 min read SVG Attribute Complete Reference 8 min read SVG Property Complete Reference 7 min read HTML Canvas Complete Reference 4 min read Like