What is an allowed characters check?

Many fields take only certain characters: a PIN takes digits, a username letters, digits and underscores, a product code capital letters and digits. An allowed characters check, also called a whitelist or allowlist check, tests that every character of a text is one you allow, and fails as soon as one isn't.

Use it to see what such a rule lets through before you build it into a form, to check data before importing it into a system with strict input rules, or to find out whether a stray character is why a form keeps rejecting your text.

Tool description

Type or paste text into the Text box, and type every character you accept into Allowed characters. The result shows as you type: "The text uses only the allowed characters." or "The text has characters that aren't allowed." With text in the box but nothing in Allowed characters yet, it reads "Fill in “Allowed characters” to see the result." An empty Text box shows no result. The text is checked exactly as typed, so spaces and line breaks count as characters too.

How the allowed characters are read

  • Each character in the field is allowed on its own, as often as the text likes: abc allows cab and abba
  • There are no ranges or shortcuts: a-z allows only a, the hyphen and z, so to allow every small letter, type the whole alphabet
  • Capital and small letters are different: abc doesn't allow ABC
  • A space is allowed only when the field has one, even if it's the only character there
  • Accented letters are characters of their own: e doesn't allow é
  • Letters of other alphabets, punctuation and emoji work just like plain letters

For example, with abcdefghijklmnopqrstuvwxyz0123456789_ as the allowed characters, happy_gardener42 passes, while Happy_Gardener (capital letters), happy gardener (a space) and happy-gardener (a hyphen) fail.

Good to know

  • The Allowed characters field has a single line, so it can't hold a line break, and text on more than one line always fails.
  • The check compares characters, not how they look: a Cyrillic а fails where only the Latin a is allowed, and 👍🏽 carries a skin tone character that 👍 alone doesn't allow. Copy such characters straight from the text into the field. To see which character is to blame, paste the text into the Unicode Character Browser, which lists its characters by name.
  • For rules about positions, such as a username that must start with a letter, try a pattern in the Regex tester.

Features

  • Checks text against any set of characters you type
  • Works with letters of any alphabet, digits, punctuation, spaces and emoji
  • Tells capital and small letters apart
  • Results as you type, with no button to press
  • Runs in your browser, so nothing you type is sent anywhere