What is a boolean?

A boolean is a value with two states, true or false, named after the mathematician George Boole. Programs store yes-or-no facts this way: whether a newsletter box is ticked, whether a feature is switched on, whether a parcel has shipped. In text, booleans show up as words or digits: true and false in JSON and many config files, 1 and 0 in databases, CSV exports and URL parameters such as ?debug=1, and yes and no in spreadsheets and settings files.

You check a boolean when a form field, an API, an environment variable or an imported file should hold one, so that a stray maybe or Y gets caught before your code reads it as true or false.

Tool description

Type or paste a value into the Value field, and the result shows as you type: "Boolean is valid" or "Boolean is not valid". Spaces and line breaks around a pasted value are ignored.

Also accept yes, no and any letter case starts off, and the check is then strict: only four values pass, exactly as written. Turn it on to accept yes and no too, and capital letters anywhere in the words.

Values that pass

  • With the setting off: true, false, 1 and 0, with the words in small letters only
  • With the setting on: true, false, yes and no in any letter case, such as True, TRUE, tRuE, Yes and NO, as well as 1 and 0

Values that always fail

  • Short forms: y, n, t, f
  • Other words: on, off, enabled, null
  • Other numbers, and other ways to write 1 and 0: 2, -1, 01, 1.0
  • Words in other languages, such as ja or oui
  • Words in quotes, as in "true", and two words, as in true false

Good to know

  • The check says whether a value is one of the accepted words, not which state it stands for: 0 and no pass just like 1 and yes.
  • In JSON, only true and false in small letters are booleans. This check also passes 1 and 0, which JSON reads as numbers.
  • YAML 1.1 and some config formats also read on, off, y and n as booleans. To accept such words, list them in the Allowed Values Checker.

Features

  • Checks true, false, 1 and 0
  • A setting for yes, no and any letter case
  • Results as you type, with no button to press
  • Runs in your browser, so nothing you type is sent anywhere