Binary Converter
Enter a number in any base (decimal, binary, hex, or octal) and see all conversions instantly.
How Binary Converter works
Number base systems
A number base (or radix) defines how many unique digits are used. Decimal (base 10) uses 0–9. Binary (base 2) uses 0 and 1. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 and A–F. Each position in a number represents a power of the base: in binary, 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal.
Binary in computing
Binary is the fundamental language of digital computers. Every piece of data — numbers, text, images, programs — is stored and processed as sequences of 0s and 1s. A single binary digit (bit) represents one of two states: on/off, true/false, high/low voltage. Eight bits form one byte, which can represent 256 values (0–255).
Why hexadecimal is used in programming
Hexadecimal is popular in programming because each hex digit maps exactly to 4 binary digits (one nibble). This makes it a compact way to represent binary data: the byte 1111 0011 becomes F3 in hex. Colour codes (#FF5733), memory addresses (0x7FFF), and MAC addresses (00:1A:2B:3C:4D:5E) all use hexadecimal notation.
Octal in Unix/Linux
Octal is used in Unix/Linux file permissions. Each octal digit represents 3 bits: read (4), write (2), execute (1). The permission 755 means the owner has rwx (7=111), group has r-x (5=101), and others have r-x (5=101). The chmod command uses octal to set these permissions.
Converting between bases manually
To convert decimal to binary: repeatedly divide by 2, collecting remainders bottom-up. 42 ÷ 2 = 21 r0, 21 ÷ 2 = 10 r1, 10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1 → 101010. To convert binary to hex: group into nibbles from the right and convert each group. 0010 1010 → 2A.
Common binary values to know
Powers of 2 appear constantly in computing: 2⁸ = 256 (one byte), 2¹⁰ = 1,024 (1 KiB), 2¹⁶ = 65,536 (16-bit range), 2³² = 4,294,967,296 (32-bit range, IPv4 address space). Maximum values: an unsigned 8-bit integer holds 0–255, 16-bit holds 0–65,535, 32-bit holds 0–4,294,967,295.
Frequently asked questions
How do I convert decimal to binary?
Divide the decimal number by 2 repeatedly and collect the remainders in reverse order. For example, 42 in binary is 101010: 42÷2=21r0, 21÷2=10r1, 10÷2=5r0, 5÷2=2r1, 2÷2=1r0, 1÷2=0r1.
How do I convert binary to decimal?
Multiply each digit by its position value (powers of 2 from right to left) and sum. For 101010: 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42.
What is 0x in front of hex numbers?
The 0x prefix indicates a hexadecimal number in most programming languages (C, JavaScript, Python, Java). 0xFF = 255 in decimal. Some languages use other notations: 0b for binary (0b1010 = 10), 0o for octal (0o12 = 10).
Why does hex use letters A-F?
Hexadecimal needs 16 unique digits. Since we only have 0–9 (ten digits), letters A–F represent values 10–15. A=10, B=11, C=12, D=13, E=14, F=15.
How many bits are in a byte?
One byte = 8 bits. A byte can represent 2⁸ = 256 different values (0–255 unsigned, or -128 to 127 signed). In hex, a byte is always two digits: 00 to FF.
What is the binary for common numbers?
1=1, 2=10, 3=11, 4=100, 5=101, 8=1000, 10=1010, 16=10000, 32=100000, 64=1000000, 100=1100100, 128=10000000, 255=11111111, 256=100000000.
Why is octal used for Unix file permissions?
Each octal digit (0–7) maps to exactly 3 bits, which perfectly represents the read/write/execute permission triplet. Permission 755 = 111 101 101 in binary, meaning owner has full access, group and others can read and execute but not write.
What is the largest number this converter handles?
This converter handles integers up to 9,007,199,254,740,991 (2⁵³ - 1), which is the maximum safe integer in JavaScript. In binary, this is a 53-bit number. For larger numbers, use a big integer library or a programming language with arbitrary precision.
Related calculators