When designing a secure OTP (One-Time Password) input field, most developers naturally use:
<input type="password" placeholder="Enter OTP" maxlength="4" id="enterotp" runat="server" />
It looks right — users see dots (••••), and their OTP remains hidden.
However, if you’ve tested this in Google Chrome, you might have noticed something annoying:
Chrome automatically shows its “Save Password” or “Manage Passwords” popup — even though it’s just a 4-digit OTP!
Let’s see why that happens and how to fix it cleanly.
Why Chrome Shows the Password Popup
Chrome’s password manager is designed to detect fields with type="password".
Whenever it finds one, it assumes you’re entering a login password and offers to save it.
In an OTP verification form, this behavior is unnecessary and confusing to users — we don’t want Chrome to save or remember temporary OTPs.
The Goal
We want to:
Show masked dots (
••••) for better privacyPrevent Chrome from showing any “Save Password” popup
Still allow users to enter numeric OTPs easily
The Correct Solution
Instead of using type="password", use type="text" and mask it using CSS.
Here’s the recommended HTML code:
<input
type="text"
id="enterotp"
placeholder="Enter OTP"
maxlength="4"
inputmode="numeric"
pattern="[0-9]*"
autocomplete="one-time-code"
autocorrect="off"
autocapitalize="none"
spellcheck="false"
style="-webkit-text-security: disc; text-security: disc;"
/>

Join the conversation! Your thoughts help the community grow.