The UPC-A barcode format is very similar to the EAN-13 barcode and is mostly used in America, although in recent years, the US is moving towards the EAN-13 format too. The UPC-A format is 12 digits long, with the last digit being the checksum (or parity) digit.
To calculate the parity for UPC-A, we use the same process as with the EAN-13 barcode. We first need add up the 11 digits of the barcode with the weighting applied. The weighting is the same as the EAN-13 weighting, where the weighting of each digit which is in an odd-numbered position is 1 and for even-numbered positions, the weighting is 3. To find the sum, we need to multiply each digit by its weighting before adding it together.
Once we have the weighted sum, we apply a modulo 10 to the weighted sum, which gets the remainder after applying a modulo of 10 to the weighted sum.
The parity is then 10 - (modulo 10 of the weighted sum).
Now that we have an 12 digit number, we can encode it.
We split the UPC-A barcode into 2 blocks of 6 digits each, with a guard bar at the beginning and end of the barcode and one in the middle of the barcode too. The end guard bars are encoded as 101, while the middle guard bar is 01010.
In the EAN-13 barcode format, the parity digit was not encoded directly, with only the first 12 digits being encoded, whereas with UPC-A, all 12 digits are encoded, including the parity. This simplifies the encoding process, since we do not have to worry about odd and even parity encodings.
The left hand side encodings are identical to the left hand odd parity encodings from EAN-13.
0
0001101
1
0011001
2
0010011
3
0111101
4
0100011
5
0110001
6
0101111
7
0111011
8
0110111
9
0001011
These encodings ensure that UPC-A forms a subset of the EAN-13 barcode.
The right hand side encodings (the last 6 digits) are the same as the right hand codings of EAN-13. The encodings are as follows: