Last Updated : 11 Jul, 2025
The HTML autocomplete Attribute is used to specify whether the input field autocompleted would be on or off. When the autocomplete attribute is set to on the browser will automatically complete the values based on what the user entered before. It works with input fields such as text, search, URL, email, password, date pickers, range, and color.
Supported Tags<element autocomplete="on | off">Attribute Values
Value
Description
on
on: It has a default value. It specifies that autocomplete is enabled.
off
It specifies that the autocomplete is disabled.
HTML autocomplete Attribute ExamplesExample 1: In this example the HTML form disables autocomplete for the input field "text_id" within the "myGeeks" form, enhancing user privacy and control over data input.
HTML
<!DOCTYPE html>
<html>
<body>
<h1>Welcome to GeeksforGeeks</h1>
<form id="myGeeks">
<input type="text"
autocomplete="off"
id="text_id"
name="fname" />
<input type="submit" />
</form>
</body>
</html>
Output:
Setting the autocomplete attribute value to offExample2: In this example the HTML form includes an input field with autocomplete enabled, enhancing user experience by suggesting previously entered values, increasing efficiency during data entry.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML autocomplete Attribute</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML autocomplete Attribute</h2>
<form id="myGeeks">
<input type="text"
autocomplete="on"
id="text_id"
name="fname" />
<input type="submit" />
</form>
</body>
</html>
Output:
autocomplete attribute Example output HTML autocomplete Attribute Use Cases 1.What is the significance of adding autocomplete attribute in HTML Form ?The autocomplete attribute in HTML forms enhances user experience by suggesting previously entered values, speeding up data entry and reducing errors.
2.How to turn on/off form autocompletion in HTML ?To turn on form autocompletion, set the autocomplete attribute to "on" for the form or individual input fields. To turn it off, set it to "off".
Supported BrowsersRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4