Binary codes can be weighted or unweighted. Weighted codes assign decimal weights to bits, like the 8-4-2-1 code. BCD is a weighted code representing each decimal digit with 4 bits. Gray code has only one bit changing between adjacent codes, making it useful for encoding shaft rotations. 1's complement inverts all bits, 2's complement adds 1 to the 1's complement. These complements allow subtraction to be performed using addition by adding the complement.