Binary Converter

Convert between binary, decimal, hexadecimal and octal instantly. Step-by-step conversion shown for every result.

Number Base Converter

Convert FROM:
Decimal (10)
Binary (2)
Hex (16)
Octal (8)
Accepts positive and negative integers
Conversion Results
Binary (Base 2)
--
Decimal (Base 10)
--
Hexadecimal (Base 16)
--
Octal (Base 8)
--
Step-by-Step (Decimal to Binary)

Binary Converter — Number Base Conversion Explained

Computers store and process all data using binary — the base-2 number system where every value is expressed using only 0s and 1s. While humans naturally use decimal (base 10), digital systems use binary because electronic circuits have two stable states: on (1) and off (0). Understanding binary and how to convert between number bases is fundamental to computer science, programming, digital electronics and networking. This converter handles the four most common number bases: decimal (base 10), binary (base 2), hexadecimal (base 16) and octal (base 8), and shows step-by-step working for every conversion.

How Binary Numbers Work

In binary, each digit position represents a power of 2, starting from 2^0 = 1 on the right and doubling with each position to the left: 1, 2, 4, 8, 16, 32, 64, 128 and so on. A binary number is read by summing the powers of 2 corresponding to positions where a 1 appears. Binary 1101 = 1x8 + 1x4 + 0x2 + 1x1 = 13. Binary 11111111 = 128+64+32+16+8+4+2+1 = 255, the maximum value of one byte. Binary 10000000 = 128. The number of values representable by n bits is 2^n: 1 bit = 2 values, 8 bits = 256 values, 16 bits = 65,536 values, 32 bits = 4,294,967,296 values. Use our scientific calculator for powers-of-2 calculations and our square root calculator for related mathematical operations.

DecimalBinaryHexadecimalOctalBits Needed
00001
11111
7111773
101010A124
151111F174
161000010205
421010102A526
1001100100641447
12711111117F1777
25511111111FF3778

Hexadecimal — Why Programmers Use It

Hexadecimal (base 16) uses digits 0-9 and letters A through F, where A=10, B=11, C=12, D=13, E=14, F=15. The key advantage of hex over binary is compactness: one hex digit represents exactly 4 binary bits, and two hex digits represent exactly one byte (8 bits). This makes hex ideal for expressing memory addresses, colour codes, byte-level data and machine code. Web colour codes like #FF5733 represent RGB values: FF=255 red, 57=87 green, 33=51 blue, each channel being one byte (0-255). Memory addresses in 64-bit systems are expressed as hex values like 0x7FFD3A2B4C10. IP addresses in IPv6 use hex: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Error codes in Windows crash screens (BSOD) are hex values. Converting hex to binary mentally is straightforward: replace each hex digit with its 4-bit binary equivalent. FF = 1111 1111, 2A = 0010 1010. Use our percentage calculator to calculate memory usage percentages and our ratio calculator for bit-to-byte ratios.

Decimal to Binary Conversion — The Division Method

To convert any positive decimal integer to binary, repeatedly divide by 2 and collect the remainders. Each remainder is either 0 or 1, which become the binary digits read from bottom to top. Example: convert 45 to binary. 45 / 2 = 22 remainder 1. 22 / 2 = 11 remainder 0. 11 / 2 = 5 remainder 1. 5 / 2 = 2 remainder 1. 2 / 2 = 1 remainder 0. 1 / 2 = 0 remainder 1. Reading remainders bottom to top: 101101. Verify: 32+8+4+1 = 45. This method works for any positive integer regardless of size. For negative numbers, computers use two's complement representation: find the binary of the positive value, flip all bits, then add 1. The two's complement of 45 (in 8 bits) is 11010011, which represents -45 in signed 8-bit arithmetic.

Hex DigitDecimalBinary (4 bits)Hex DigitDecimalBinary
000000881000
110001991001
220010A101010
330011B111011
440100C121100
550101D131101
660110E141110
770111F151111

Binary Arithmetic — Addition, Subtraction and Overflow

Binary arithmetic follows the same rules as decimal arithmetic but with only two digits. Binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (0 carry 1), 1+1+1=11 (1 carry 1). Example: 1011 + 0110 = 10001 (11 + 6 = 17 in decimal). Overflow occurs when the result requires more bits than the register width allows. An 8-bit register can hold values 0-255 (unsigned) or -128 to 127 (signed). If an 8-bit addition produces a result greater than 255, the extra bit is discarded and the result wraps around — this is integer overflow, a common source of software bugs. The classic example: 255 + 1 in 8-bit unsigned arithmetic = 0 (not 256), because 11111111 + 00000001 = 100000000, and the 9th bit is discarded leaving 00000000. Understanding binary arithmetic is essential for systems programming, embedded systems and security. Use our fraction calculator for fractional number work and our scientific calculator for scientific notation and powers.

Octal and Its Historical Role in Computing

Octal (base 8) uses digits 0 through 7. Each octal digit represents exactly 3 binary bits, making it another compact representation of binary data. Octal was widely used in early computing systems including the DEC PDP-8 and early Unix systems because early word sizes (12, 24, 36 bits) divided evenly by 3. Today octal is primarily used in Unix and Linux file permission notation. The chmod command uses octal: 755 means 111 101 101 in binary = rwxr-xr-x (owner can read/write/execute, group and others can read/execute). 644 = 110 100 100 = rw-r--r-- (owner reads/writes, others read only). 777 = 111 111 111 = rwxrwxrwx (everyone full access). To convert octal to binary, replace each octal digit with its 3-bit binary equivalent: octal 7 = 111, octal 5 = 101, octal 3 = 011. Octal 753 = 111 101 011 in binary = decimal 491.

Bits, Bytes and Data Storage Units

A bit (binary digit) is the smallest unit of digital information, holding a value of 0 or 1. A byte is 8 bits and can represent 256 distinct values. All digital data — text, images, audio, video, programs — is ultimately stored as sequences of bytes. The standard data units and their binary relationships: 1 byte = 8 bits. 1 kilobyte (KB) = 1,024 bytes = 2^10 bytes. 1 megabyte (MB) = 1,048,576 bytes = 2^20 bytes. 1 gigabyte (GB) = 1,073,741,824 bytes = 2^30 bytes. 1 terabyte (TB) = 2^40 bytes. The use of 1,024 rather than 1,000 as the multiplier is because binary powers of 2 nearest to 1,000 is 2^10 = 1,024. Hard drive manufacturers use 1,000-byte kilobytes (decimal) while operating systems use 1,024-byte kibibytes (binary), which is why a drive labelled 500GB shows as approximately 465GB in Windows. Use our percentage calculator to calculate the percentage difference between decimal and binary storage sizes.

Binary in Everyday Computing

Binary encoding underlies every piece of digital information you interact with. ASCII (American Standard Code for Information Interchange) encodes each text character as a 7-bit binary number: the letter 'A' is 1000001 (decimal 65), 'a' is 1100001 (97), '0' is 0110000 (48). UTF-8, the dominant text encoding standard on the web, extends ASCII to encode over 1.1 million Unicode characters using 1-4 bytes per character. Image files store pixel colour values as binary: each pixel in an RGB image uses 3 bytes (24 bits) storing red, green and blue values from 0-255 each. A 1920x1080 uncompressed image requires 1920 x 1080 x 3 = 6,220,800 bytes (about 6MB) before compression. Audio files store amplitude samples as binary: CD audio uses 16 bits per sample at 44,100 samples per second per channel. Understanding binary is the foundation of understanding how every digital system from your calculator to your phone actually stores and processes information. Our scientific calculator handles powers-of-two calculations for computing tasks, and our percentage calculator is useful for calculating storage efficiency ratios between compressed and uncompressed formats.

Bitwise operations are fundamental to low-level programming and are supported in virtually every programming language. The AND operator (&) returns 1 only when both bits are 1: 1100 AND 1010 = 1000. OR (|) returns 1 when either bit is 1: 1100 OR 1010 = 1110. XOR (^) returns 1 when bits differ: 1100 XOR 1010 = 0110. NOT (~) flips all bits. Left shift (<<) multiplies by powers of 2: 0011 << 1 = 0110 (3 x 2 = 6). Right shift (>>) divides by powers of 2: 1100 >> 1 = 0110 (12 / 2 = 6). These operations are used for tasks including setting flags in configuration bytes, masking specific bits in hardware registers, fast multiplication and division, and implementing cryptographic algorithms. Understanding binary representation is a prerequisite for understanding how these operations work at the hardware level. Our scientific calculator supports scientific notation for large binary values and our square root calculator is useful for related mathematical computations in computer science problems.

Frequently Asked Questions

How do I convert binary to decimal? +
Multiply each binary digit by 2 raised to its position power (starting at 0 from the right), then sum all results. Binary 1101: (1x2^3) + (1x2^2) + (0x2^1) + (1x2^0) = 8+4+0+1 = 13. Or use our converter above -- paste any binary number into the Binary input and click Convert to see all bases instantly.
How do I convert decimal to binary? +
Repeatedly divide by 2 and record remainders. Read remainders bottom to top. Example: 13 / 2 = 6 r1, 6/2 = 3 r0, 3/2 = 1 r1, 1/2 = 0 r1. Reading bottom to top: 1101. Our converter shows each division step so you can follow the working. Enter any decimal number and select the step-by-step result.
What is hexadecimal and why is it used? +
Hexadecimal (base 16) uses digits 0-9 and A-F (A=10 through F=15). One hex digit = exactly 4 binary bits, making it a compact binary representation. Used for: web colour codes (#FF5733), memory addresses (0x7FFD3A2B), machine code, error codes (BSOD stops), and IPv6 addresses. Two hex digits = one byte, so hex is natural for byte-level data.
How do I convert binary to hexadecimal? +
Group binary digits into sets of 4 from the right (pad with leading zeros if needed), then convert each group using the hex table: 0000=0, 0001=1, ..., 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. Example: 11010110 = 1101 0110 = D6. Our converter does this automatically for any input.
What is the octal number system? +
Octal (base 8) uses digits 0-7. Each octal digit = 3 binary bits. Used mainly in Unix/Linux file permissions: chmod 755 = rwxr-xr-x. Octal 7 = 111 (binary) = read+write+execute. Octal 5 = 101 = read+execute. Octal 4 = 100 = read only. To convert octal to binary, replace each digit with its 3-bit binary equivalent.
How many bits are in a byte? +
One byte = 8 bits. A byte can represent 256 values (2^8 = 256), from 0-255 in decimal or 00-FF in hex. 1 kilobyte = 1,024 bytes (2^10). 1 megabyte = 1,048,576 bytes (2^20). 1 gigabyte = 1,073,741,824 bytes (2^30). Storage drive manufacturers use 1,000-byte kilobytes while operating systems use 1,024, which is why a 500GB drive shows as ~465GB in Windows.
What is two's complement? +
Two's complement is how computers represent negative integers in binary. To find it: (1) write the positive binary value, (2) flip all bits (one's complement), (3) add 1. Example: -5 in 8-bit: +5 = 00000101, flip = 11111010, add 1 = 11111011. This is why 8-bit signed integers range from -128 to +127 (not -127 to +127). Two's complement makes binary subtraction work as addition.