HTML accesskey Attribute Last Updated : 11 Jul, 2025 Comments Improve Suggest changes 5 Likes 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 Create Quiz Comment I IshitaNegi Follow 5 Improve I IshitaNegi Follow 5 Improve Article Tags : Web Technologies HTML HTML-Attributes Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like