Input masks and formatting as you type

Fields that reformat or block what people type can prevent mistakes, and can also fight them as they type.

Typing a card number with spaces, as it is printed. A strict field refuses the spaces. A forgiving field accepts them, removes them itself, and says what it expects in text outside the field.

The answer

Accept the separators people type and clean them up yourself, and show the expected shape outside the field. As strong as the weakest rule behind it: moderate.

The other rules

Accessibility

Open questions

  • OpenNo controlled study, review or published online experiment of masks against free entry was found for card numbers, ZIP codes or currency.
  • OpenThe single phone experiment was inconclusive because the mask itself was faulty.
  • OpenWhether formatting on leaving the field avoids the problems of formatting on each keystroke: untested.
Checked November 12, 2026

Sources