Bit Code Converter

Hamming Code Encoder

๐Ÿ“˜ Hamming Code Basics

๐Ÿ”น Definition

Hamming codes are a type of error-detecting and error-correcting code that allows the detection and correction of single-bit errors in data transmission or storage. They add extra parity bits to data to ensure accuracy.

๐Ÿ”น Formula

To find number of parity bits (p):
2p โ‰ฅ m + p + 1
Where:
p = parity bits,
m = data bits

๐Ÿ”น Important Points

  • Two main types: Even Parity and Odd Parity
  • Parity bits are placed at positions that are powers of 2 (1, 2, 4, 8, ...)
  • Each parity bit checks a specific set of bits, based on binary positions.
  • Can correct single-bit errors and detect two-bit errors.
  • Widely used in computer memory (ECC RAM) and communication systems.

๐Ÿ”น Process

  1. Determine p using the formula.
  2. Place parity bits at positions: 1, 2, 4, 8, etc.
  3. Fill remaining positions with data bits.
  4. Calculate each parity bit value by checking specific positions.
  5. Transmit the full codeword (data + parity bits).

๐Ÿ”น Example

Data: 1011 (Even Parity)

Step 1: m = 4 โ†’ Find p using 2p โ‰ฅ m + p + 1

Step 2: p = 3 โ†’ Total bits = 7 โ†’ Positions (reverse view): P1, P2, D1, P4, D2, D3, D4 โ†’ shown as bit 7 to bit 1.

Step 3: Fill data bits (7โ†’1): 1 0 1 _ 1 _ _

Step 4: Calculate parity bits:

  • P1 (bit 1) = ?
  • P2 (bit 2) = ?
  • P4 (bit 4) = ?

Final Hamming Code (7โ†’1): 1 0 1 P4 1 P2 P1

Hamming Code Error Detector

๐Ÿ“˜ Concept: Hamming Code Error Detection

Definition: Hamming Code is an error-detecting and error-correcting code that can detect up to two-bit errors and correct one-bit errors in data transmission.

Formula for Parity Bits:

2^p โ‰ฅ m + p + 1
Where:
p = number of parity bits
m = number of data bits
  

๐Ÿ“Œ Concept:

Hamming code error detection works by using parity bits placed at specific positions in the data. Each parity bit is responsible for checking certain positions (including itself) to ensure the total number of 1s matches the chosen parity (even or odd). If a bit is flipped due to transmission errors, one or more parity checks will fail. By combining the positions of failed parity bits, we can find the exact location of the error and correct it.

๐Ÿ›  How Detection Works (Step-by-step):

  1. Number the bit positions starting from 1 (left to right or right to left, depending on convention).
  2. Identify parity bit positions (powers of 2 โ†’ 1, 2, 4, 8, ...).
  3. Each parity bit checks a group of positions following its pattern:
    • P1 checks positions 1, 3, 5, 7, 9, ...
    • P2 checks positions 2, 3, 6, 7, 10, ...
    • P4 checks positions 4โ€“7, 12โ€“15, ...
  4. If a parity check fails, note down its position value.
  5. Add up the values of failed parity bits โ†’ this sum gives the exact position of the error.
  6. Flip the bit at that position to correct the code.

๐Ÿ’ก Example (Even Parity):

Received code:  0 1 0 0 0 1 1
Position index: 1 2 3 4 5 6 7
Parity type:    Even

Step 1: Check P1 โ†’ bits 1, 3, 5, 7 โ†’ (0, 0, 0, 1) โ†’ 1 one โ†’ FAIL  
Step 2: Check P2 โ†’ bits 2, 3, 6, 7 โ†’ (1, 0, 1, 1) โ†’ 3 ones โ†’ FAIL  
Step 3: Check P4 โ†’ bits 4, 5, 6, 7 โ†’ (0, 0, 1, 1) โ†’ 2 ones โ†’ PASS  

Failed parity bits: P1 (1), P2 (2) โ†’ Sum = 1 + 2 = 3  
โ†’ Error is in position 3.

Step 4: Flip bit 3 โ†’ Corrected code: 0 1 1 0 0 1 1

โœ… Key Points:

  • Position numbers are important for locating the error.
  • Only one-bit errors can be detected and corrected with basic Hamming code.
  • Multiple-bit errors may go undetected or be incorrectly corrected.

Number System Converter

Concept of Number System Conversion

Number systems are ways of representing numbers using different bases:

How Conversion Works:

  1. To Decimal: Multiply each digit by its base power and sum them up.
    Example: 1011โ‚‚ = (1ร—2ยณ) + (0ร—2ยฒ) + (1ร—2ยน) + (1ร—2โฐ) = 8 + 0 + 2 + 1 = 11
  2. From Decimal: Keep dividing by the target base and take remainders in reverse order.
    Example: 26 โ†’ divide by 16 โ†’ quotient=1, remainder=10 (A) โ†’ result: 1Aโ‚โ‚†
  3. Direct Conversion: For binary โ†” octal/hex, group bits in sets of 3 (octal) or 4 (hex) and convert directly.

Gray Code Converter

What is Gray Code?

Gray code is a binary numeral system where two successive values differ by only one bit. It is often used in digital communication and error correction to minimize errors during transitions.

Binary โ†’ Gray: The first bit remains the same; each next bit is the XOR of the previous binary bit and the current binary bit. Gray โ†’ Binary: The first bit remains the same; each next binary bit is the XOR of the previous binary bit and the current Gray bit.

Example:
Binary: 1011 โ†’ Gray: 1110

About Bit Code Converter

Bit Code Converter is your all-in-one solution to encode data with Hamming codes, detect transmission errors, and convert between binary, gray, decimal, octal, and hexadecimal formats.

Built for learners, students, and engineers seeking fast, accurate, and interactive tools in one suite.

Contact Us

๐Ÿ“ฌ Email: learnwithhraghava@gmail.com

๐Ÿ’ฌ We'd love your feedback and suggestions to improve Bit Code Converter!

Privacy Policy

We do not collect or store any personal information unless you choose to sign up. Your data stays yours.

All tools operate locally in your browser for speed and security.

Terms & Conditions

This tool is for educational and learning purposes only.

We provide no guarantee for correctness in mission-critical applications.

Click