Boolean Logic

Boolean logic appears in the new National Curriculum for Computing at KS3. It is also a key to understanding the the truth tables and logic gates that appear in GCSE Computer Science.   Boolean logic is named after George Boole, and describes a way of combining "truth values" in calculations. Truth values are best thought of as true or false, but can also be thought of as any pair of opposites, e.g. yes/no, on/off, or 1/0, where true = yes = on = 1 and false = no = off = 0.

This demonstration uses switches and bulbs. You can turn a switch on or off by clicking it, and you can change the boolean operator by selecting one from the list. Try switching both switches on and off and see if you can see how AND, OR and NOT work. When used in circuits like this, these logical operators are also known as logic gates. If you would like a more technical description, or would like to see truth tables, look at the Boolean Logic page in the Mathematics section.


Unfortunately the interactive part of this page requires a wider screen. If you are using a mobile device you could try changing the orientation to landscape.

The result of an AND is only true if both switches are on, and the result of an OR is true if either switch is on. EOR is short for exclusive OR (sometimes also written as XOR) and is only true if the switches aren't in the same position (i.e. the bulb only lights if one switch is on and one is off).

Notice that NOT only has one input - the state of the bulb is the opposite of the state of the switch.

There is also another page on logic circuits in this section. For a more in-depth discussion of this and other similar techniques, including truth tables, look at the Boolean Logic page in the Mathematics section.