A bar code is a sequence of alternating black and white lines, which encodes a sequence of numbers or letters. They are intended for use in 'keyless data entry' for automated identification of items. Scanning a bar code is easy, fast and accurate, reducing the work and removing the human error introduced in data entry.

Bar codes can be scanned and decoded with little or no errors under most conditions, often without human intervention. Bar code readers typically use a red laser to detect the edges of the lines, thus allowing the bar code to be read from almost any direction.

The symbology of a bar code is similar to that of Morse code. A sequence of symbols are encoded using 2 signals (in the case of a bar code, a black line or a white line, in the case of Morse code, a 'dit' or a 'dah'). While it may appear that a bar code consists of different widths of lines, all of the lines are, in fact, the same width. Wider lines occur when two or more lines of the same colour are adjacent.

As well as encoding a string of characters, the bar code will usually include a checksum at the end to improve accuracy. If the checksum is incorrect, the reading is discarded.

There are many encoding schemes used in bar codes, some allowing alphanumeric characters to be encoded:

UPC is the standard encoding for grocery bar codes and ISBN numbers on books. This encoding represents the digits 0-9, each with 2 black lines a 2 white lines, with widths of 1-4, up to a total of 7:
  |   ## #|
0 |   ## #|
  |   ## #|

  |  ##  #|
1 |  ##  #|
  |  ##  #|

  |  #  ##|
2 |  #  ##|
  |  #  ##|

  | #### #|
3 | #### #|
  | #### #|

  | #   ##|
4 | #   ##|
  | #   ##|

  | ##   #|
5 | ##   #|
  | ##   #|

  | # ####|
6 | # ####|
  | # ####|

  | ### ##|
7 | ### ##|
  | ### ##|

  | ## ###|
8 | ## ###|
  | ## ###|

  |   # ##|
9 |   # ##|
  |   # ##|
The bar codes are split into two groups of 6 numbers. To read a UPC bar code, there are some special rules. The 2nd, 3rd and 5th nubers are inverted and read backwards and the 6th - 12th numbers are inverted. This is to reduce errors in the reading and to indicate the orientation of the bar code.