Try editing the text below to see how the barcode changes!
You can check out the Wikipedia page for Code 128 for the details, but here's the basics.
Each character is represented as a particular sequence of bars and spaces. The barcode always starts with a START sequence, and ends with the STOP sequence.
For error detection, there's a checksum just before the STOP sequence.
There are actually three different ways of encoding data into the barcode, but this page only supports two: Code B and Code C. Code C is used for encoding numbers, and Code B is used for encoding text. Try typing several numbers in a row to see it switching between encodings. Code A is used for encoding special characters.