BitMaster: Binary & Hex Trainer
Sharpen binary, hex, and two's complement mental conversion speed, advance through 12 Computing Architecture rank tiers, and conquer 21 stages across 6 core computing topics.
8-Bit Binary Register
Toggle individual bits, step values, or switch encoding modes to see how denary and hex are represented in hardware.
In unsigned binary, every bit represents a positive power of 2. The place values start at 1 on the far right (Least Significant Bit, LSB) and double with each step moving left: 1, 2, 4, 8, 16, 32, 64, 128.
128, 64, 32, 16, 8, 4, 2, 1.00101010 → 32 + 8 + 2 = 42 in denary.
Long binary strings like 11011010 are difficult to read and error-prone for humans. Computer scientists use Hexadecimal (Base 16) as a compact, human-friendly shorthand. Because 16 = 2⁴, each hexadecimal digit represents exactly 4 binary bits (1 nibble).
Common Notations
0x2A, 0xFF)#FF5733)2A₁₆)Converting Hex to Denary
The "10" Trap
Computer screens mix Red, Green, and Blue light. Each colour channel gets 1 byte (0 to 255), represented by 2 hex digits (00 to FF). Combining the three channels produces a 6-digit hex code such as #FF8733.
Type in Denary, Hexadecimal, or Binary to instantly synchronize all three representations. Supports numbers up to 2⁴⁰ (1,099,511,627,775).
The sum of these two numbers exceeds 255 (11111111₂). The final addition in the MSB (128 column) created a carry bit that spilled over into a 9th bit. Because this register only holds 8 bits (1 byte), this 9th bit is lost, causing an incorrect result.
Key concept: "Overflow occurs when a calculation's result requires more bits than the CPU register has allocated to store it."
CPUs don't waste silicon on separate subtraction circuits. Instead, the ALU flips Number B into its negative Two's Complement, and simply adds it to A! Subtraction is literally free addition.
CPUs frequently manipulate raw bits rather than whole arithmetic numbers. This is called Bitwise Logic. In GCSE exams, the most important use case is Bit Masking: isolating, testing, clearing, or setting specific bits in a byte.
Output bit is 1 ONLY if BOTH Bit A and Bit B are 1. If either is 0, the output is 0.
val AND 00000001 checks if a number is odd (result 1) or even (result 0).
In computer architecture, a Logical Shift moves all bits inside a register to the left or right. Vacated positions are always padded with 0. Shifting left multiplies the number by 2 for each position shifted ($2^1 = 2, 2^2 = 4, 2^3 = 8$), while shifting right performs integer division by 2.
1 falls off past bit 7 (128), an overflow error occurs. When shifting right, if a 1 falls off past bit 0 (1), fractional precision is truncated/lost.
| Unit & Symbol | Scale Name | Decimal (SI) — All Zeros Written Out | Binary (IEC) Prefix | Binary (IEC) Value |
|---|---|---|---|---|
| Byte (B) | Single Byte | 1 Byte | - | 1 Byte |
| Kilobyte (kB) | One Thousand | 1,000 Bytes (103) | Kibibyte (KiB) | 1,024 Bytes (210) |
| Megabyte (MB) | One Million | 1,000,000 Bytes (106) | Mebibyte (MiB) | 1,048,576 Bytes (220) |
| Gigabyte (GB) | One Billion | 1,000,000,000 Bytes (109) | Gibibyte (GiB) | 1,073,741,824 Bytes (230) |
| Terabyte (TB) | One Trillion | 1,000,000,000,000 Bytes (1012) | Tebibyte (TiB) | 1,099,511,627,776 Bytes (240) |
| Petabyte (PB) | One Quadrillion | 1,000,000,000,000,000 Bytes (1015) | Pebibyte (PiB) | 1,125,899,906,842,624 Bytes (250) |
It can be hard to picture what "1 Petabyte" actually means. Standard high-quality MP3 audio (128 kbps stereo) plays at roughly 16 kB per second (about 1 MB per minute). Explore how much continuous music and real-world media fits into each level!
Enough for 17.4 hours of continuous non-stop music playback! Over 250 typical MP3 pop songs in a playlist without repeating.
A single gigabyte holds a decent playlist or an hour of video streaming. Downloaded in about 15 seconds on superfast fibre broadband!
Why does a 1,000 GB drive show as 931 GB in your operating system?
1. Hardware Manufacturers sell in Decimal (SI): Hard drive and SSD makers count in standard everyday powers of 10. To them, 1 GB = 1,000,000,000 bytes (109).
2. Operating Systems calculate in Binary (IEC): Because computer memory (RAM) is wired in powers of 2, operating systems address storage using 1,024-byte multipliers: 1 GiB = 1,073,741,824 bytes (230).
The Result: When you plug in a 1,000 GB drive, Windows divides the 1,000,000,000,000 bytes by 1,073,741,824. The drive isn't faulty or secretly robbed of space — it's simply a difference between base-10 and base-2 math!
Binary (Base 2) & Hexadecimal (Base 16)
• Binary Place Values: 128, 64, 32, 16, 8, 4, 2, 1 for an 8-bit byte. Range of an unsigned byte is 0 to 255.
• Hexadecimal: Uses digits 0–9 and letters A–F (A=10, B=11, C=12, D=13, E=14, F=15).
• Why Hex? Much easier for humans to read and remember than long binary strings; exactly 1 hex digit represents 4 bits (1 nibble), and 2 hex digits represent 1 full byte (8 bits).
Binary Addition & Overflow Error
• Addition Rules: 0+0=0, 1+0=1, 1+1=0 carry 1, 1+1+1=1 carry 1.
• Overflow Error: Occurs when the sum exceeds the allocated number of bits (e.g. an 8-bit result > 255). The MSB carry has no storage slot and is dropped, causing incorrect results.
• Consequence: In software, overflow can cause silent bugs or security vulnerabilities (buffer wrap-arounds).
Decimal vs Binary Data Units
• Bit vs Byte: 1 bit = single 0 or 1. 1 byte (B) = 8 bits. 1 nibble = 4 bits.
• Decimal Prefixes (Powers of 10): 1 kB = 1,000 B, 1 MB = 1,000 kB, 1 GB = 1,000 MB, 1 TB = 1,000 GB.
• Binary Prefixes (IEC, Powers of 2): 1 KiB = 1,024 B (210), 1 MiB = 1,024 KiB (220), 1 GiB = 1,024 MiB (230).
• AQA Exam Note: AQA accepts decimal 1,000 multipliers for kB/MB unless specified otherwise in the question.
Two's Complement & Sign Bits
• Two's Complement: The most significant bit (MSB) represents -128 instead of +128. Range of an 8-bit signed byte is -128 to +127.
• Negating a Value: To find the negative counterpart of any binary number, invert all bits (0→1, 1→0) and add 1.
• Sign & Magnitude: An alternative method where the MSB is simply 0 for positive and 1 for negative, but suffers from two zeros (+0 and -0).
Logical Shifts (Multiplication & Division)
• Logical Left Shift: Shifts bits left by n positions, inserting 0s at the right. Multiplies the value by 2n.
• Left Shift Risk: If 1 bits are shifted out of the MSB, overflow occurs and precision is lost.
• Logical Right Shift: Shifts bits right by n positions, inserting 0s at the left. Performs integer division by 2n.
• Right Shift Truncation: Any 1s shifted off the right boundary are dropped (integer truncation / loss of precision).