Number Base Converter Guide: Binary, Decimal, Hexadecimal & Octal Explained
Binary uses only 0 and 1; hexadecimal uses 0–9 and A–F. Converting decimal 255 to binary gives 11111111; to hex: FF. Learn the step-by-step conversion methods.
How Positional Notation Works
In any base-N system, each position represents a power of N. The rightmost position is N⁰ = 1, the next is N¹ = N, then N², N³, and so on. Decimal 1,234 = 1×10³ + 2×10² + 3×10¹ + 4×10⁰ = 1000 + 200 + 30 + 4. Binary 1011 = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11 in decimal. Hexadecimal 2AF = 2×16² + 10×16¹ + 15×16⁰ = 512 + 160 + 15 = 687 in d
Decimal to Binary and Back
To convert decimal to binary: use the successive division algorithm. Divide the number by 2 repeatedly, recording each remainder. When the quotient reaches 0, the binary representation is the remainders read from bottom to top. Example: decimal 100. 100÷2=50r0, 50÷2=25r0, 25÷2=12r1, 12÷2=6r0, 6÷2=3r0, 3÷2=1r1, 1÷2=0r1. Binary = 1100100 (read bottom
Hexadecimal (Base 16)
Hexadecimal uses digits 0–9 and letters A–F (A=10, B=11, C=12, D=13, E=14, F=15) to represent values 0–15 with a single character. Hex is popular because one hex digit maps perfectly to 4 binary bits, making it extremely compact for representing binary data. Decimal to hex: same repeated division, divide by 16. Decimal 255: 255÷16=15r15(F), 15÷16=0
Octal (Base 8)
Octal uses digits 0–7. Like hex, it maps cleanly to binary — 3 binary bits = 1 octal digit. Octal was more common in older computing systems (DEC PDP computers) and is still used in Unix file permissions. Unix file permissions: chmod 755 = 7(111)-5(101)-5(101) in binary = owner (rwx), group (r-x), others (r-x). Understanding octal directly reads th
Frequently Asked Questions
How do I memorize the binary numbers 0–15?
Learn the four binary place values for a 4-bit number: 8, 4, 2, 1 (powers of 2 from right to left). Then each binary number is just which place values are 'on.' 0101 = 4+1 = 5. 1010 = 8+2 = 10. 1111 = 8+4+2+1 = 15. Practice by converting small numbers in your head during spare mo
Why do programmers use hexadecimal instead of binary?
Hexadecimal is more compact and readable than binary while still mapping cleanly to binary. An 8-bit byte takes 8 binary digits (11010110) but only 2 hex digits (D6). A 32-bit memory address needs 32 binary digits or 8 hex digits (like 0x7FFE0040). Humans make many more errors re
How are colors represented in hexadecimal?
Web/CSS colors use a 6-digit hex format #RRGGBB where each pair represents one of three color channels: red, green, blue — each from 0 (00) to 255 (FF). #FF0000 = pure red (255,0,0). #00FF00 = pure green. #0000FF = pure blue. #FFFFFF = white (all channels at 255). #000000 = black
What is two's complement?
Two's complement is the standard method computers use to represent negative integers in binary. For an n-bit system, the most significant bit (MSB) is the sign bit: 0 = positive, 1 = negative. To negate a number: flip all bits, then add 1. Example (8-bit): +5 = 00000101. Flip: 11
What is the difference between a bit and a byte?
A bit is the smallest unit of digital information — a single binary digit (0 or 1). A byte is a group of 8 bits, capable of representing 256 different values (0–255 or 00–FF in hex). Data storage uses bytes (kilobytes, megabytes, gigabytes). Network speed uses bits (megabits per