Number Base Converter
Convert between binary, decimal, octal, and hexadecimal. Type in any field and all others update instantly.
How Number Base Conversion Works
Every number can be represented in different bases. The decimal system we use daily is base-10, meaning it uses digits 0 through 9. Binary (base-2) uses only 0 and 1. Octal (base-8) uses 0 through 7. Hexadecimal (base-16) uses 0 through 9 plus letters A through F. Each system is just a different way of writing the same value.
Binary 1010 = 1x23 + 0x22 + 1x21 + 0x20 = 8 + 0 + 2 + 0 = 10 (decimal)
Why Binary Matters
Computers operate entirely in binary because their circuits have two states: on (1) and off (0). Every file, image, video, and program on your computer is ultimately stored as a sequence of ones and zeros. Understanding binary is fundamental to computer science, networking (IP addresses, subnet masks), and low-level programming.
Why Hex Is Used in Programming
Hexadecimal is popular in programming because each hex digit represents exactly 4 binary digits (bits), making it a compact way to express binary data. One byte (8 bits) can be written as exactly 2 hex digits. Color codes in CSS and HTML use hex (like #FF5733). Memory addresses, MAC addresses, and error codes are also commonly expressed in hexadecimal.
Common Conversions
Some values come up repeatedly in computing: 255 decimal = FF hex = 11111111 binary (maximum value of one byte). 256 = 100 hex = the number of values one byte can hold. 65535 = FFFF hex = maximum value of two bytes. 127 = 7F hex = maximum value of a signed byte.
Number Base Converter FAQ
How do I convert binary to decimal?
Write out the binary number. Starting from the rightmost digit, multiply each digit by increasing powers of 2 (1, 2, 4, 8, 16, 32...). Add up the results. For example, binary 1101 = 1x8 + 1x4 + 0x2 + 1x1 = 13 in decimal.
How do I convert decimal to binary?
Divide the decimal number by 2 repeatedly, recording the remainder each time. Read the remainders from bottom to top. For example, 13 / 2 = 6 remainder 1, 6 / 2 = 3 remainder 0, 3 / 2 = 1 remainder 1, 1 / 2 = 0 remainder 1. Reading bottom to top: 1101.
What is hexadecimal used for?
Hexadecimal is used in programming for color codes (like #FF5733 in CSS), memory addresses, MAC addresses, byte values, and any context where a compact representation of binary data is useful. Each hex digit maps to exactly 4 binary digits, making conversion simple.
What is the difference between hex and binary?
Both represent the same values in different bases. Binary (base-2) uses only 0 and 1. Hexadecimal (base-16) uses 0-9 and A-F. Hex is more compact: the binary number 11111111 is just FF in hex. One hex digit always equals exactly 4 binary digits.
What is a byte?
A byte is 8 binary digits (bits). It can represent values from 0 to 255 (decimal) or 00 to FF (hexadecimal). One byte can store one ASCII character, and it is the fundamental unit of data in computing. A kilobyte is 1,024 bytes, a megabyte is 1,048,576 bytes, and so on.