Number System Converter

Convert between binary, octal, decimal and hexadecimal — fractions and very large numbers included — and see every step: division tables, multiplication tables, place values and bit grouping.

Class 9–12 & Computer Science All 4 bases at once Bit visualiser 1's & 2's complement

To convert decimal to binary, divide by 2 repeatedly and read the remainders from bottom to top: 45 ÷ 2 gives remainders 1, 0, 1, 1, 0, 1, so 45₁₀ = 101101₂. To go back, multiply each digit by its place value: 32 + 8 + 4 + 1 = 45.

Your number

Choose the base you are converting from.

Fractions like 1010.101 and negative numbers work. Prefixes 0b, 0o and 0x switch the base.
Try an example

Step-by-step working

Bit visualiser

Tap any bit to switch it on or off — the number above updates.

1's and 2's complement

How computers store negative whole numbers (Class 11 Computer Science).

Quick reference: 0 to 31

Tap a row to load that number.

How it works

One number, four ways to write it

Every positional number system works the same way — only the base changes. Computers use binary; octal and hex are short-hands for long binary strings.

Pick the base

BIN, OCT, DEC or HEX — or just type a prefix like 0x1F.

Type the number

Invalid digits are flagged instantly, e.g. 8 is not allowed in octal.

Read all four

Tap any result to make it the new input, or copy it with its prefix.

Learn the method

Open each tab for the exact division, multiplication or grouping working.

Decimal → any base

Whole part: divide by the base again and again; write the remainders from bottom to top.

Fraction part: multiply by the base again and again; write the whole-number parts from top to bottom. Some fractions (like 0.1) never end in binary — they recur.

Any base → decimal

Multiply each digit by its place value and add. Place values are powers of the base:

1010.101₂ = 8 + 2 + 0.5 + 0.125 = 10.625

Binary ↔ octal and hex

Since 8 = 2³ and 16 = 2⁴, group binary digits in 3s for octal and 4s for hex, starting from the binary point and padding with zeros. 1101 0110₂ = D6₁₆.

Two's complement

To store −n: write n in binary, invert every bit (1's complement), then add 1 (2's complement). In 8 bits, −45 = 11010011 and the range is −128 to +127.

Where you will meet these: colours in web pages (#DC2626 is hex), IPv4/IPv6 addresses, Unix file permissions (chmod 755 is octal) and every byte of memory (8 bits, 00–FF in hex).
Questions & answers

Number System Converter — your questions

How do you convert a decimal number to binary?

Divide the number by 2 again and again, writing down the remainder each time, until the quotient is 0. Then read the remainders from the bottom upwards. For 25: remainders are 1, 0, 0, 1, 1 read upwards, so 25₁₀ = 11001₂. Check by adding place values: 16 + 8 + 1 = 25.

How do I convert binary to decimal?

Multiply each digit by its place value and add. Place values are powers of 2 counted from the right: 1, 2, 4, 8, 16 and so on. So 1010.101₂ = 8 + 2 + 0.5 + 0.125 = 10.625. After the binary point the place values are 1/2, 1/4, 1/8 and so on.

How do you convert binary to hexadecimal quickly?

Because 16 = 2⁴, group the binary digits in fours starting from the binary point and pad with zeros, then write the hex digit for each group. 11010110₂ splits into 1101 and 0110, which are D and 6, so the answer is D6₁₆. For octal, group in threes instead, since 8 = 2³.

How do you convert a decimal fraction to binary?

Multiply the fractional part by 2 repeatedly and write the whole-number part of each product from the top downwards, dropping it before the next multiplication. 0.625 × 2 = 1.25, 0.25 × 2 = 0.5, 0.5 × 2 = 1.0, so 0.625 = 0.101₂. Some fractions such as 0.1 never terminate and recur forever.

What is 2's complement and how do I find it?

It is how computers store negative numbers. Write the number in binary, invert every bit to get the 1's complement, then add 1. In 8 bits, 45 is 00101101, inverting gives 11010010, and adding 1 gives 11010011 for −45. An 8-bit signed range runs from −128 to +127.

Why do computers use binary, octal and hexadecimal?

Electronic circuits have two reliable states, on and off, which binary represents directly. Long binary strings are hard for people to read, so octal and hexadecimal act as shorthand — one hex digit stands for four bits. You meet hex in web colours like #DC2626 and octal in Unix permissions like chmod 755.