1. Maths Calculators
  2. Binary Calculator

Binary Calculator

Convert between binary, decimal, hexadecimal and octal. Add and subtract binary numbers with full carry workings. Perform AND, OR, XOR and NOT bitwise operations. Essential for GCSE Computer Science and programming.

Conversion Reference Table (0–15)

DecimalBinaryHexOctal

What Is Binary? The Base-2 Number System

Binary is a base-2 number system that uses only two digits: 0 and 1. Every number you can write in decimal (base 10) can also be written in binary — just using a different set of symbols. The word bit comes from binary digit.

Computers use binary because electronic components can reliably represent two states: a transistor is either off (0) or on (1). Building reliable circuits for ten distinct states (as decimal would require) is far more complex. By working in binary, engineers can design circuits that are fast, cheap and reliable.

How Place Values Work in Binary

Just as decimal uses powers of 10 (ones, tens, hundreds, thousands…), binary uses powers of 2:

Position (from right)Power of 2Value
1st (units)201
2nd212
3rd224
4th238
5th2416
6th2532
7th2664
8th27128

To convert binary to decimal, multiply each digit by its place value and add the results. For example: 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 8 + 0 + 2 + 1 = 11.

Converting Decimal to Binary (Division Method)

Divide the decimal number by 2 repeatedly and record the remainders. Then read the remainders from bottom to top.

Example: Convert 13 to binary

13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1

Reading remainders upward: 1310 = 11012

Binary Addition with Carries

Binary addition uses four simple rules:

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 10 (write 0, carry 1)
  • 1 + 1 + 1 = 11 (write 1, carry 1)

These rules mirror decimal addition but with only two values. The carry propagates leftward exactly as in decimal arithmetic.

Two's Complement: Negative Numbers in Binary

Computers represent negative numbers using two's complement. To find the two's complement of a binary number:

  1. Write the number in binary (using enough bits, e.g. 8).
  2. Flip all the bits (change 0 to 1 and 1 to 0) — this is the one's complement.
  3. Add 1 to the result.

For example, to represent −5 in 8-bit binary: +5 = 00000101 → flip: 11111010 → add 1: 11111011. This method makes subtraction equivalent to adding the negative number, simplifying CPU design enormously.

Hexadecimal and Its Relationship to Binary

Hexadecimal (hex, base 16) is used extensively in computing because it provides a compact representation of binary data. Each hex digit represents exactly 4 binary bits (called a nibble). The hex digits are 0–9 and A–F:

DecimalBinary (4-bit)Hex
101010A
111011B
121100C
131101D
141110E
151111F

To convert binary to hex: group bits in fours from the right, then replace each group with its hex digit. For example: 11110101 = 1111 0101 = F516.

Bits, Bytes and Storage Sizes

Understanding the hierarchy of data storage units is essential for computer science:

UnitSizeValues Possible
1 bit1 binary digit2 (0 or 1)
4 bits (nibble)1 hex digit16
8 bits (byte)2 hex digits256 (0–255)
1 kilobyte (KB)1,024 bytes8,192 bits
1 megabyte (MB)1,024 KB~8.4 million bits
1 gigabyte (GB)1,024 MB~8.6 billion bits
1 terabyte (TB)1,024 GB~8.8 trillion bits

Bitwise Operations in Programming

Bitwise operations compare binary numbers bit by bit. They are used extensively in programming for flags, masks, permissions, encryption and graphics:

  • AND (&): Result bit is 1 only if both input bits are 1. Example: 1010 AND 1100 = 1000.
  • OR (|): Result bit is 1 if either input bit is 1. Example: 1010 OR 1100 = 1110.
  • XOR (^): Result bit is 1 if the bits are different. Example: 1010 XOR 1100 = 0110. XOR is used in checksums and simple encryption.
  • NOT (~): Flips all bits. Example: NOT 1010 = 0101 (in 4-bit).

ASCII and Binary: How Text Becomes Numbers

Text characters are stored in computers as numbers, then those numbers are stored as binary. The ASCII (American Standard Code for Information Interchange) standard assigns a number to each character. For example: the letter A = 6510 = 010000012. A space = 3210 = 001000002. Modern systems use Unicode (UTF-8), which extends ASCII to cover all world languages, emojis and special symbols.

Binary in GCSE Computer Science

Binary, hexadecimal and number systems are a core topic in GCSE Computer Science (AQA, OCR, Eduqas, WJEC). Key skills include:

  • Converting between binary, decimal and hexadecimal
  • Binary addition and the role of overflow
  • Two's complement for negative numbers
  • Logical shifts (left shift = multiply by 2; right shift = divide by 2)
  • Bitwise AND, OR and NOT
  • Understanding storage units: bit, nibble, byte, KB, MB, GB, TB

Related Calculators

Frequently Asked Questions

Binary is a base-2 number system that uses only two digits: 0 and 1. Each digit is called a bit. Computers use binary because electronic circuits can reliably represent two states — off (0) and on (1). All data stored and processed by computers — text, images, sound, programs — is ultimately sequences of 0s and 1s.
Divide the decimal number by 2 repeatedly, recording the remainder each time. Read the remainders from bottom to top. For example: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1. Reading remainders upward: 13 in binary is 1101.
Binary addition uses four rules: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1). Add column by column from right to left, just as in decimal addition. For example: 1011 + 0110 = 10001. The carry propagates to the left.
Hexadecimal (hex) is base-16, using digits 0–9 and letters A–F. Each hex digit represents exactly 4 binary bits (a nibble). This makes conversion between binary and hex very easy: split binary into groups of 4 from the right, then replace each group with its hex equivalent. For example: 11110101 = 1111 0101 = F5 in hex.
8 bits (1 byte) can represent 28 = 256 different values, from 0 to 255 (unsigned), or from −128 to +127 (signed, using two's complement). This is why colours in RGB are three bytes (red, green, blue each 0–255), giving over 16 million possible colours.
A bit (binary digit) is the smallest unit of data — a single 0 or 1. A byte is 8 bits. A kilobyte (KB) = 1,024 bytes; a megabyte (MB) = 1,024 KB; a gigabyte (GB) = 1,024 MB; a terabyte (TB) = 1,024 GB. Hard drive manufacturers use decimal (1 KB = 1,000 bytes), which is why a "1 TB" drive shows as about 931 GB in Windows.
MB

Mustafa Bilgic

UK Maths & Computing Specialist • About UK Calculator • Updated February 2026