What’s Bit Stuffing?

Print anything with Printful



Bit stuffing adds extra non-data bits to computer data to ensure correct interpretation. It prevents errors, synchronizes clocks, and maintains transmission pace. The computer discards the extra bits.

Bit stuffing, sometimes referred to as positive justification, is the process of adding extra non-data information into a string of computer data, usually to ensure that the data is read correctly when the computer receives it. Computer data consists of bits of information in the form of 1s and 0s. A code is used to signal the beginning and end of a block of data. When the actual information transmitted might be garbled for this code and ignored, extra bits, such as 0s, are inserted—padded—into the code so the computer knows what data to process.

Also known as bit padding, bit stuffing helps prevent errors when a computer receives information. The bits do not represent any actual information, and once all the data is transmitted, the computer discards or ignores the unnecessary bits. For example, if the cue for the start of a line of code were five 1s in a row and the actual data being sent began with five 1s, the computer would think this was the cue and erase it. To avoid this, a zero bit would be inserted between the fourth and fifth 1 so that it reads as “111101” instead of “11111”. The computer would then throw off the zero and read the data as five units instead of throwing it away.

Another use of bit stuffing is to compile a string of data that requires a certain number of bits to be transmitted correctly. A string of information may need to be at least 10 bits long, but only have nine of them present. In this situation, an extra bit would be added to bring the total to 10. The extra bit would be discarded when the data is interpreted.

In addition to helping the computer interpret chunks of data correctly, bit stuffing is also used to help the computer synchronize. A computer sends and receives information at a constant rate based on its internal clock. If too many of the same bits are sent, such as a row of all 0s, the computer clock could get out of sync and execute commands in the wrong order. Placing a 1 in the 0’s row forces the computer clock to resynchronize and prevents this problem.

Similar to helping a computer stay in sync, bit stuffing also helps the computer read data correctly when information is sent in bits rather than as a continuous stream. To trick the computer into seeing the transmission as continuing, random bits are generated and sent to the computer as it waits for the next actual block of information to be transmitted. This keeps the transmission pattern at a steady pace.

The computer is capable of stripping non-data bits from data streams once they are received. Computer programmers need to know which bits to insert so that the computer removes them instead of reading them as real data. If the computer attempted to interpret these stuffed bits instead of discarding them, it would cause computer errors in the program.




Protect your devices with Threat Protection by NordVPN


Skip to content