HTML input autofocus Attribute Last Updated : 22 Feb, 2025 Comments Improve Suggest changes Like Article Like Report The autofocus attribute in HTML is used to specify that a particular form element (like an input field, textarea, or select dropdown) should automatically receive focus when the page is loaded, allowing the user to start interacting with it immediately without needing to click on it.Syntax<input autofocus>Note: It is a Boolean Attribute means it doesn't need any value.ExampleTip: Run this code, without using the autofocus attribute. HTML <!DOCTYPE html> <html> <head> <title> HTML input autofocus Attribute </title> </head> <body style="text-align:center"> <h1 style="color: green;"> GeeksforGeeks </h1> <h2> HTML input autofocus Attribute</h2> Name: <input autofocus="" type="text"/> <br/> <br/> <!-- Assign id to the Button. --> <button id="GFG"> Submit </button> <br/> </body> </html> Output:HTML input autofocus AttributeSupported BrowsersThe browser supported by HTML <input>autofocus Attribute are listed below:Google ChromeInternet ExplorerFirefoxOperaSafariImportant Points About AutoFocus Attributeautofocus is a simple, effective way to improve the user experience by directing the user's attention to a specific form element immediately upon page load.Only one element should have the autofocus attribute on a page to avoid unexpected behavior.It enhances usability, especially in forms and interactive elements, but should be used with care, especially with accessibility considerations in mind. Comment More infoAdvertise with us M manaschhabra2 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