Skip to content
100% local

Hamming error-correcting code

Encode data with a Hamming(7,4) code and automatically correct single-bit errors.

Input
Output

Hamming error-correcting code

Hamming code adds a small number of parity bits to a block of data so a single flipped bit can be detected and repaired automatically, with no retransmission needed. This tool implements the classic Hamming(7,4) scheme: every 4 bits of data become a 7-bit codeword carrying 3 parity bits, encoded or decoded entirely in your browser.

Switch direction with the Direction option. Encode turns your data into codewords; Decode & correct takes codewords — possibly with one flipped bit per block, as if picked up over a noisy line — and recovers the original 4 data bits, reporting how many blocks needed a correction. The two directions are inverses, so a swap turns encoded output straight back into decodable input. Data format sets whether the plain-data side is text (UTF-8 bits) or a raw string of 0s and 1s; Codeword format writes each 7-bit codeword as binary digits or as a compact 2-digit hex byte. Batch mode treats each line as an independent record, so you can encode or decode many short messages at once with totals for the whole set.

Short binary input is padded with zero bits to a full 4-bit block before encoding; decoding drops any leftover bits that can't complete a byte when rebuilding text. CRLF and LF line endings in batch mode are treated the same way. If a codeword isn't 7 valid binary digits or a hex byte in range, or binary input holds anything but 0 and 1, the tool names the exact line and what's wrong instead of guessing.

Everything runs locally — your data is never uploaded. Copy the result, download it as a .txt file, or send the output back into the input to encode a message and then decode it in two steps to see the correction happen.

FAQ

What does Hamming(7,4) actually protect against?
It can correct any single flipped bit within each 7-bit codeword. If two or more bits in the same codeword are wrong, the result is unreliable — the code has no way to tell a double error from a different single error.
How is the plain data mapped into codewords?
Data is split into 4-bit blocks. Each block becomes a 7-bit codeword made of 3 parity bits and the original 4 data bits, arranged at the standard Hamming positions.
What happens to text input that is not a multiple of 4 bits?
It is padded with zero bits to the next full 4-bit block before encoding. Decoding drops any trailing bits that can't complete a full byte when the result is read back as text.
What does the corrected count in the tally mean?
It shows how many codewords had a single-bit error detected and automatically fixed during decoding. Zero means every codeword arrived intact.
Is my data uploaded anywhere?
No. Encoding and decoding run entirely in your browser — nothing you paste here is sent to a server.