Convert between binary, decimal, hexadecimal, and octal with step-by-step working. Interactive bit toggle, learn mode quiz, binary arithmetic, two's complement, and ASCII conversion. Perfect for GCSE & A-Level Computer Science.
Get instant answers without steps
0b101010
42
0x2A
0o52
0x2A = 0010 1010
Decimal
0
Hex
0x0
Octal
0o0
How helpful was this?
Help other students find great tools
A number base (or radix) determines how many different digits can be used in a counting system. We normally use base 10 (decimal) with digits 0-9, but computers use base 2 (binary) with just 0 and 1.
In GCSE Computer Science, you need to understand binary, decimal, hexadecimal (base 16), and sometimes octal (base 8).
Multiply each digit by its place value (power of 2) and add
1011₂ = 8+0+2+1 = 11₁₀
Repeatedly divide by 2 and read remainders bottom-up
13 → 6r1 → 3r0 → 1r1 → 0r1 = 1101₂
Each hex digit = 4 binary bits (a nibble)
1010 1111₂ = AF₁₆
Memorise the first 16 place values: 1, 2, 4, 8, 16, 32, 64, 128, 256... This makes binary-decimal conversion much faster!
Computers are built from billions of tiny switches called transistors. Each transistor can only be in one of two states: on (1) or off (0). Binary is the natural language of these switches.
With only two possible states, there's no ambiguity. Electrical signals are either high or low — no need to distinguish between 10 different voltage levels. This makes binary reliable and fast.
Everything in a computer is binary: text (ASCII/Unicode), colours (hex codes like #FF0000), images, sound, and even the programs themselves.
Web colours use hex to represent Red, Green, and Blue values (0-255 each).
MAC Addresses
A1:B2:C3:D4:E5:F6
Each pair is a hex byte identifying network hardware
Memory Addresses
0x7FFF5FBFF8AC
Hex is compact: 48 binary bits become 12 hex digits
Error Codes
0xDEADBEEF • 0xCAFEBABE
Famous debug markers used in software development
Why hex over binary? Hex is a compact representation — one hex digit replaces 4 binary bits. The byte 11111111 becomes just FF. Much easier to read!
Both bits must be 1
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
At least one bit is 1
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Exactly one bit is 1
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Flip the bit
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Networks use AND with a subnet mask to determine if two devices are on the same network.
XOR flips specific bits without affecting others — used in encryption and game logic.
AND with a NOT mask sets specific bits to 0 while keeping others unchanged.
✗ Reading binary remainders top-down instead of bottom-up
✓ Always read remainders from the LAST division to the FIRST when converting decimal to binary.
✗ Forgetting to pad hex-to-binary groups to 4 bits
✓ Each hex digit MUST produce exactly 4 bits. Hex 3 is 0011, not 11.
✗ Mixing up AND, OR, and XOR operations
✓ AND: both must be 1. OR: at least one is 1. XOR: exactly one is 1. Memorise the truth tables!
✗ Forgetting to add 1 in two's complement (only inverting)
✓ Two's complement is TWO steps: invert all bits AND THEN add 1. Inverting alone is one's complement.
✗ Starting positional values from 2¹ instead of 2⁰
✓ The rightmost position is always 2⁰ = 1, not 2¹ = 2. Place values go: ...8, 4, 2, 1.
✗ Confusing unsigned and signed binary ranges
✓ Unsigned 8-bit: 0 to 255. Signed two's complement 8-bit: -128 to +127. The sign bit halves the positive range.
Place values: 128 64 32 16 8 4 2 1
Bits: 1 1 0 1 0 1 1 0
Active: 128 + 64 + 16 + 4 + 2
= 214₁₀
200 ÷ 2 = 100 r0
100 ÷ 2 = 50 r0
50 ÷ 2 = 25 r0
25 ÷ 2 = 12 r1
12 ÷ 2 = 6 r0
6 ÷ 2 = 3 r0
3 ÷ 2 = 1 r1
1 ÷ 2 = 0 r1
Read ↑: 11001000₂
Carries: 1 1 1 1
01101001
+ 00110110
─────────
10011111
Check: 105 + 54 = 159 ✓
Step 1: +42 = 00101010
Step 2: Invert = 11010101
Step 3: Add 1 = 11010110
-42 = 11010110₂
Sign bit = 1 (negative) ✓
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (carry 1)
Example: 1011 + 0110 = 10001
Step 1: Start with +5 = 00000101
Step 2: Flip all bits = 11111010
Step 3: Add 1 = 11111011
-5 in two's complement = 11111011
Write the place values (1, 2, 4, 8, 16...) above each binary digit from right to left. Add up the place values where there's a 1. Example: 1011 = 8+2+1 = 11.
Divide by 2 repeatedly and note the remainders. Read the remainders from bottom to top for the binary number. Example: 13÷2=6r1, 6÷2=3r0, 3÷2=1r1, 1÷2=0r1 → 1101.
Hexadecimal is used in computing because each hex digit represents exactly 4 binary bits. This makes it easier to read and write binary data. It's used for colours (e.g., #FF0000), memory addresses, and MAC addresses.
Add column by column from right to left using: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1). If three 1s meet: 1+1+1=11 (write 1, carry 1).
Two's complement is how computers store negative numbers. To find it: flip all bits (0→1, 1→0), then add 1. The leftmost bit is the sign bit (0=positive, 1=negative).
Yes! It covers the entire GCSE number systems topic for OCR, AQA, and Edexcel, including binary/hex conversion, binary arithmetic, two's complement, and ASCII.
An 8-bit unsigned number ranges from 0 (00000000) to 255 (11111111). That's 2⁸ = 256 possible values. For signed two's complement, the range is -128 to +127.
Use nibble grouping: each hex digit = 4 binary bits. To convert, replace each hex digit with its 4-bit binary (e.g., A=1010). To go binary→hex, group from the right in 4s.
One's complement only inverts the bits. Two's complement inverts then adds 1. Two's complement is preferred because it has only one representation of zero and simpler arithmetic.
ASCII assigns a number (0-127) to each character. 'A' = 65, 'a' = 97, '0' = 48, space = 32. This lets computers store, transmit, and process text as binary numbers.
All our tools are 100% free with step-by-step learning