Skip to content
Bugwise
Menu
UI Components

Password Field

The masked text field where people type, paste or autofill a secret. Learn show/hide, password managers and autofill, rules vs strength meters, and the truncation, paste and accessibility bugs that lock real users out.

35 min Inputs & selection iOS · Android · Web Also called: Password input, Secure text field

Logging into your bank, creating an account in a food delivery app, confirming a payment, changing your password after a breach: the password field is the gate to almost every account. When it works, nobody notices. When it doesn’t, users can’t get in, and they blame themselves (“I must have forgotten it”) before they blame the app.

A password field is a text field with a few extra jobs: hide the value, let people reveal it, play nicely with password managers, and explain the rules. Each job has its own classic bugs. The bigger flow around it (generic error messages, lockout, sessions, reset links) lives on the Login & sign up page. This page is about the field itself.

What is a password field?

A password field is a single-line text field that masks what you type, showing dots instead of characters. It’s used for passwords, PINs typed on a keyboard, and other secrets like an API key or a card’s security code.

It comes in two flavors, and they behave differently:

  • Current password (login, confirm before deleting the account): the user types or autofills a password that already exists. It must accept it exactly as it was saved.
  • New password (sign-up, change password, reset): the user invents one. The field shows the rules, maybe a strength meter, and password managers offer to generate one.

Anatomy

1

New password

••••••••••23
Caps Lock is on5
  • At least 12 characters
  • Not a commonly used password
  • Doesn’t contain your email name
  • 4
Use suggested passwordkQ7v-mzxp-T3rw-hB9e6
  1. 1

    Label

    A visible, permanent label ("Password", "New password"). The placeholder is not a label.

  2. 2

    Masked value

    Each character is shown as a dot. The field must still accept typing, paste and autofill.

  3. 3

    Show / hide toggle

    Reveals the password. Needs a name ("Show password"), a state, a 44 pt / 48 dp touch area, and must keep the cursor where it was.

  4. 4

    Password rules

    Shown before the user types, then ticked off live. Not a surprise after the first failed attempt.

  5. 5

    Caps Lock warning

    Web and desktop: a hint when Caps Lock is on, so users don’t lock themselves out by accident.

  6. 6

    Autofill / password manager

    The system offers a saved or a generated strong password. Only works if the field is marked up correctly.

How it differs from similar components

ComponentWhat’s differentTypical use
Password fieldMasked, never autocorrected, managers fill itLogin, sign-up, change password
Text fieldShows the value, may autocorrectName, email, notes
One-time code fieldDigits only, often split boxes, SMS autofill2FA codes
PIN padOn-screen digits, fixed lengthApp lock, card PIN
Dev note

iOS calls it a secure text field (isSecureTextEntry in UIKit, SecureField in SwiftUI). Android uses an EditText with inputType="textPassword", or a Material TextInputLayout with a password toggle. On the web it’s <input type="password">. Screen readers announce it as “secure text field” or “password”.

Designs & variants

The parts are the same everywhere; what changes is who helps the user. On iOS it’s the Passwords app and its QuickType bar, on Android the autofill service (Google Password Manager or another manager), on the web the browser and extensions.

Every field here works. Type something, reveal it, put the cursor in the middle and reveal again: the cursor should stay where it was.

QuickType bar above the keyboard (tap a field)

Login with saved password

iOS

With the right content types (.username, .password) iOS offers the saved login in the QuickType bar. One tap fills both fields; nobody types a 20-character password.

New password

Suggested: hapzov-4Kuqwe-rydtiX. Saved in Passwords.

Strong password suggestion

iOS

On a sign-up field marked .newPassword, iOS offers a generated password and saves it. The yellow field shows it was filled automatically. Android and browsers have their own version.

At least 12 characters

Outlined field with eye icon

Android · Material 3

The trailing icon toggles visibility. The icon changes and so does its name: 'Show password' becomes 'Hide password'. The field keeps focus.

Text toggle + Caps Lock warning

Web

'Show' / 'Hide' text is clearer than an icon for many users. On desktop, the field warns when Caps Lock is on (try it with a keyboard).

  • At least 12 characters, not yet
  • Not a commonly used password, not yet
  • Doesn’t contain your email name, not yet

Rules up front, ticked off live

Web

Users see the rules before typing and watch them turn green. No guessing, no surprise error after submitting.

Naive meter (character types)

Strength: Strong · Counts character types only.

Length + common-password list

Strength: Very weak · This is one of the most common passwords. Attackers try it first.

Two strength meters, one password

Web

The naive meter calls 'Password1!' strong and a long passphrase weak. A meter that checks length and common passwords gets both right. Try the chips.

Show / hide: small button, many details

Masking protects against someone looking over your shoulder, but it also hides typos. That’s why almost every modern password field has a show/hide toggle. A good one:

  • Has a name that says what it does (“Show password”) and tells the state: either the name changes to “Hide password”, or it’s a toggle button with a pressed state. An icon alone says nothing to a screen readerScreen readerSoftware that reads the screen aloud for blind and low-vision users, like VoiceOver or TalkBack.Open in glossary →.
    Dev note
    On the web: aria-pressed.
  • Keeps the value and the cursor position. Tap it in the middle of typing and keep typing: the new characters must go where the cursor was, not to the start.
  • Keeps focus in the field (on mobile, the keyboard shouldn’t close and reopen).
  • Goes back to hidden when the user leaves the screen or submits, so the password isn’t still visible later.
  • Has a big enough touch area: at least 44×44 pt on iOS and 48×48 dp on Android. On the web, WCAG 2.5.8 (AA) asks for at least 24×24 CSS px; 44×44 px (2.5.5, AAA) is the comfortable target.

Password managers and autofill

Many people never type their passwords: a password managerPassword managerA tool that stores credentials and fills them into login forms, like Apple Passwords, Google Password Manager or 1Password.Open in glossary → fills them in. That only works if the field tells the system what it is, and if the app doesn’t fight the manager.

FieldWeb autocompleteiOS textContentTypeAndroid autofillHints
Email / usernameusername.usernameusername / emailAddress
Login passwordcurrent-password.passwordpassword
Sign-up / new passwordnew-password.newPasswordnewPassword

What to check:

  • Login: the saved password is offered (iOS QuickType bar, Android autofill dropdown, browser key icon) and fills both username and password.
  • Sign-up: the system suggests a strong password, fills it in, and offers to save it with the right username.
    Dev note
    On iOS, apps can describe their rules with passwordRules so the suggestion actually passes them; on the web Safari reads the passwordrules attribute.
  • Paste works. Users of password managers that don’t autofill copy and paste. Blocking paste doesn’t make anything safer; it pushes people to shorter passwords they can type. WCAG 2.2 criterion 3.3.8 Accessible Authentication (Minimum) (Level AA) expects login not to depend on remembering or retyping a password, and allowing paste and autofill is the usual way to meet it.
  • autocomplete="off" is a smell. On password fields most browsers ignore it, some managers honor it, so behavior becomes unpredictable. It’s never a security fix.
  • App and website share passwords when they’re linked: on iOS through Associated Domains, on Android through Digital Asset Links. A password saved on the website should be offered in the app.

Rules, checklists and strength meters

Users can only follow rules they can see. Show them before the user types, then tick them off live. Error messages that reveal one rule at a time (“Needs a number.” → “Needs a symbol.” → “Too short.”) are a classic usability bug.

Strength meters are trickier than they look. The common, naive version counts character types: lowercase, uppercase, digit, symbol. That’s exactly what attackers expect. It rates Password1! as Strong (it’s one of the first passwords any attacker tries) and a long passphrase like sunflower meadow at dusk as Weak. Current guidance, like NIST’s SP 800-63B, favors length and checking against lists of common and breached passwords over composition rules.

Length, spaces and other characters

Caps Lock and other helpers

On computers, Caps Lock is the top reason for “I typed the right password”. A web field can detect it while you type and show a warning. Safari on macOS shows its own Caps Lock indicator in password fields. Phones don’t need this, their keyboards show the shift state.

Dev note
event.getModifierState('CapsLock').

Keep the secret secret

A few security basics belong to the field itself:

  • Never in the URL or logs. The password goes in a POST body, not in ?password=…, and never into analytics events or crash logs. Check the network traffic with DevToolsDevToolsDeveloper tools built into browsers for inspecting pages, network traffic and errors.Open in glossary → or a proxy tool.
  • No copy out of a masked field. Browsers and the OS disable Copy and Cut while the value is hidden.
  • No autocorrect, no suggestions, no autocapitalize. Otherwise the keyboard may learn the password and suggest it later.
  • Screenshots and screen recording on sensitive screens: Android apps can block screenshots and recording and blank the app in the recent apps view. iOS has no switch to block screenshots; apps hide sensitive content when screen capture is detected and cover the screen in the app switcher.
    Dev note
    On Android that’s FLAG_SECURE on the window.

When to use it

A password field is the right choice when:

  • The value is a secret that people nearby shouldn’t see: password, PIN on a keyboard, recovery phrase, API key.
  • The user must type it again later exactly as now, so a typo matters (that’s why reveal is so useful).
  • Password managers should recognize the field.

Good and bad uses

One password field + show/hide

Create a password

••••••••••••Show

Users check their password by revealing it. Password managers fill one field easily.

'Confirm password' with paste blocked

Password

••••••••••••

Confirm password

•••••••••••

Pasting is not allowed. Passwords don’t match.

Retyping a hidden password twice, without paste, is slow and still doesn’t show the typo.

Show rules up front

Create a password

 
  • ✗ At least 12 characters
  • ✗ Not a commonly used password

The user knows the target before typing and sees each rule turn green.

Rules as a surprise

Create a password

••••••••

Invalid password.

What’s invalid? Too short? Missing a symbol? Users guess, retry and give up.

Also avoid a password field for things that aren’t secret: masking a username, a promo code or an amount only makes typos harder to see. And a one-time code has its own field type, with SMS autofill.

Dev note
autocomplete="one-time-code".

Common bugs

#BugWhat you seeTypical severity
1Silent truncationSign-up accepts 20 characters, login cuts to 16: the right password never worksCritical
2Paste blockedPaste does nothing; password manager users can’t log inHigh
3Autofill brokenNo saved password offered, or the email lands in the password fieldHigh
4Toggle without name or stateScreen reader says just “button”High (for affected users)
5Toggle moves the cursorAfter revealing, new characters go to the start, or the field is clearedMedium
6Misleading strength meterPassword1! is “Strong”, a long passphrase is “Weak”Medium
7Rules hidden until failure“Invalid password” with no hint, or one rule revealed per attemptMedium
8Inconsistent rulesSign-up allows spaces or emoji, login or reset rejects themHigh
9Spaces trimmed on one side only“Secret123 ” saved at sign-up doesn’t match at loginHigh
10Password leaksVisible in the URL, a log, an analytics event or the app switcherCritical (security)
11Stays revealedCome back to the screen and the password is still in plain textMedium
12Autocorrect onThe keyboard “fixes” the password or suggests it laterMedium

Stress-test it

Sign-up and login are two different forms that must agree on the same secret. Change how each one treats length and spaces, switch the feedback style and the autocomplete value, and use the presets.

🧪 Password lab

One account, two forms: what sign-up saves and what login later sends. Change how each side treats the password and see if the user can still get in.

Maximum length
Leading / trailing spaces
Feedback while typing
autocomplete attribute

Strength: Weak · Counts character types only.

Password manager: Unpredictable: many browsers still fill passwords, some password managers skip the field. Never use it to "block" managers.

Sign-up saves (24)

sunflower·meadow·at·dusk

Login sends (16)

sunflower·meadow

Values differ: "Email or password is incorrect", forever.

Same intent in native apps

iOS textContentType: (none) · Android: importantForAutofill="no"

The login field silently cuts the password to 16 characters. Sign-up saved 24, so this user can never log in with the password they chose.

Sign-up trims leading/trailing spaces but login doesn’t. Same password, different values: login fails.

The naive meter says "Weak", a length + blocklist check says "Strong". Users trust the meter, so a wrong one teaches bad passwords.

autocomplete="off" on a password field: password managers may ignore the field or save the wrong thing. Use current-password on login and new-password on sign-up.

Find the bug

Harbor Bank’s login and sign-up pages share one buggy password component. There’s already an account for anna@example.com; its password is in the password manager panel below the browser. Explore it like a real tester:

  • Log in with Anna’s saved password: copy and paste it, then type it.
  • Reveal the password in the middle of typing, then keep typing.
  • Create an account with a weak password, then a common one, then a long one, and log in with it.
  • Turn on the screen reader and Tab through the form.
  • Watch the network log after every attempt.

🐞 Bug hunt: Harbor Bank login

This demo has 6 hidden bugs. Explore it like a tester, then check your findings.

Found0/6
bank.example.com

Harbor Bank

Device

Password manager · saved login

anna@example.com · Blue-Kettle-Sings-42

Network log
  • Log in or create an account to see requests…
  1. 1

    Hint: Copy Anna's password from the password manager panel and paste it into the password field.

  2. 2

    Hint: Type Anna's 20-character password into the login field, reveal it, and check the network log.

  3. 3

    Hint: Turn on the screen reader and Tab from the password field to the eye icon.

  4. 4

    Hint: Type half a password, tap the eye, then type a few more characters.

  5. 5

    Hint: On Create account, type Password1! and read the meter. Then try a long passphrase without capitals.

  6. 6

    Hint: On Create account, look for the rules before you submit anything.

How to test it

Checklist

Password field test checklist

0 of 15 checked

Example test cases

TC-PWD-001Long password works across sign-up and login

Steps

  1. Sign up with a 64-character password
  2. Log out
  3. Log in with the same password (type it, then paste it)
  4. Repeat on the website and in the app

Test data

Password: 64 characters including spaces and "č"

Expected result

All 64 characters are accepted on every form; login succeeds everywhere. No field cuts the value.

TC-PWD-002Paste into the password field

Steps

  1. Copy a password from a password manager
  2. Long-press the password field and choose Paste (or Ctrl/⌘ + V)

Expected result

The password is pasted in full and masked.

TC-PWD-003Saved password is offered on login

Preconditions

  • A login for anna@example.com is saved in the device's password manager

Steps

  1. Open the login screen
  2. Tap the email field
  3. Pick the saved login from the suggestion

Expected result

Email and password are both filled; the password field stays masked; Log in works.

TC-PWD-004Show/hide keeps the cursor position

Steps

  1. Type "Secret"
  2. Tap Show password
  3. Type "123"
  4. Tap Hide password

Expected result

The field shows "Secret123" in plain text after step 3. Focus and keyboard stay; the final value is "Secret123".

TC-PWD-005Common password is rejected

Steps

  1. Open Create account
  2. Enter "Password1!" as the password
  3. Tap Create account

Expected result

The password is rated very weak or rejected with a message like "This password is too common".

TC-PWD-006Leading and trailing spaces are handled consistently

Steps

  1. Sign up with " Secret123 " (spaces at both ends)
  2. Log in with " Secret123 "
  3. Log in with "Secret123"

Expected result

Behavior matches the spec and is the same on every form: either spaces are kept (only the first login works) or trimmed everywhere (both work).

TC-PWD-007Toggle announced by VoiceOver

Preconditions

  • VoiceOver is on

Steps

  1. Swipe to the eye icon
  2. Double-tap
  3. Listen to the announcement

Expected result

VoiceOver says "Show password, button", then "Hide password" (or "selected") after activating it.

TC-PWD-008Password is not sent in the URL or logs

Preconditions

  • DevTools Network tab or a proxy tool is recording

Steps

  1. Log in
  2. Inspect the login request
  3. Check analytics and crash-report requests sent at the same time

Expected result

The password is only in the body of a POST over HTTPS; it never appears in a URL, header, analytics or log entry.

Tip: click a test case to expand it.

Accessibility

  • A real label: “Password” or “New password”, connected in code. Screen readers announce it as “secure text field” (iOS) or “password” (web, TalkBack) and don’t read the characters aloud.
  • The toggle needs a name and a state (WCAG 4.1.2 Name, Role, Value, Level A): “Show password” / “Hide password”, or a pressed state. It should be reachable with TabKeyboard navigationUsing a website with only the keyboard: Tab to move, Enter or Space to activate, Esc to close.Open in glossary → and work with Enter and Space.
    Dev note
    On the web the state is aria-pressed.
  • Autofill and paste (WCAG 3.3.8 Accessible Authentication (Minimum), Level AA): don’t make people memorize and retype. Mark the field’s purpose so autofill works (also WCAG 1.3.5 Identify Input Purpose, Level AA).
    Dev note
    With autocomplete.
  • Rules and errors are text, linked to the field, and announced. A live checklist should not spam the screen reader on every keystroke; the final state matters.
    Dev note
    Linked with aria-describedby.
  • Strength meters must not rely on color alone: show the word (“Weak”, “Strong”) too. Text needs 4.5:1 contrast, the meter bars and field border 3:1 (WCAG 1.4.3 / 1.4.11).
  • Touch targetsTouch targetThe area of the screen that responds to a tap, which should be large enough for a finger.Open in glossary →: at least 44×44 pt on iOS and 48×48 dp on Android. On the web, WCAG 2.5.8 (AA) asks for at least 24×24 CSS px; 44×44 px (2.5.5, AAA) is the comfortable target.
  • No tight time limits on typing a password; if there is a session timeout, warn before it ends.

Mobile vs web

  • There’s no built-in reveal button: apps switch between a secure and a normal field, which is exactly where cursor and focus bugs come from.
    Dev note
    UITextField with isSecureTextEntry = true, or SecureField in SwiftUI.
  • With Associated Domains, passwords saved for the website appear in the app.
    Dev note
    Set textContentType to .username, .password or .newPassword. Associated Domains use webcredentials:.
  • Strong Password suggestions appear on new-password fields and should match the app’s rules.
    Dev note
    They appear on .newPassword fields; passwordRules makes the generated password match the app’s rules.
  • The last typed character is shown briefly before it turns into a dot. That’s normal.
  • Test with the Passwords app and a third-party manager, VoiceOver, Dynamic Type, and the app switcher (does the screen hide sensitive content?).
Dev note
EditText with inputType="textPassword", or Material TextInputLayout with endIconMode="password_toggle". In Compose, a TextField with PasswordVisualTransformation and a trailing icon button.
  • Test with Google Password Manager and a third-party autofill service (Settings › Passwords & autofill).
    Dev note
    Set autofillHints (password, newPassword, username).
  • If the spec says so, check that sensitive screens block screenshots and screen recording and are blanked in Recents.
    Dev note
    That’s FLAG_SECURE.
  • The “Show passwords” setting makes characters appear briefly while typing.
  • Test with TalkBack, font scale, and a hardware keyboard or Chromebook.
Dev note
<input type="password"> with a <label> and autocomplete="current-password" or "new-password". The email field gets autocomplete="username".

Related pages: the whole login flow, account enumeration and lockout are on Login & sign up, the reset flow on Password reset, and general text input bugs on Text field.

Check your understanding

Quick quiz

0/5 answered · 0 correct

  1. 1.Sign-up accepted a 20-character password, but login always says "Email or password is incorrect". What do you suspect first?

  2. 2.The product owner wants to block paste in the password field "for security". What do you say?

  3. 3.Which autocomplete value belongs on a sign-up password field?

  4. 4.A strength meter rates "Password1!" as Strong. Why is that a bug?

  5. 5.What should a screen reader say on the eye icon next to a password field?

Key takeaways

  • A password field is a masked text field whose value must be accepted exactly, by every form that touches it.
  • Never cut a password silently. Test the same long password (spaces, emoji, accents) on sign-up, login, change, reset, app and web.
  • Password managers need current-password / new-password (and the iOS and Android equivalents) and working paste.
  • Show/hide needs a name, a state, and must keep value, focus and cursor.
  • Show rules up front and be wary of strength meters that only count character types.
  • The password never belongs in a URL, log or screenshot.

Finished this page?Nice work, this page is complete!

Mark it as done to track your progress. It's saved in this browser, no account needed.

Its review cards are now in Bites ⚡
Esc

Type to search the whole site.