Convert between binary (base-2), octal (base-8), decimal (base-10), and hexadecimal (base-16) for free. Essential tool for programming, networking, and digital systems.
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
A numeral system is a way to represent numbers. Binary uses only 0 and 1, octal uses 0-7, decimal uses 0-9, and hexadecimal uses 0-9 and A-F. Computers internally use binary, but convert to hexadecimal or decimal for human readability.
Base-N to Decimal: Multiply each digit by the base raised to its position power and sum. Example: (1011)₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11
Decimal to Base-N: Repeatedly divide by target base and read remainders in reverse order.
One hexadecimal digit represents exactly 4 binary digits. For example, F(hex) = 1111(binary), A(hex) = 1010(binary). This relationship makes hex preferred by programmers for representing long binary numbers.
Octal is primarily used in Unix/Linux file permission systems (e.g., chmod 755). It was widely used in systems that weren't based on 8-bit architecture, but hexadecimal is now more common. It's convenient for grouping 3 bits at a time.
A through F represent decimal 10 through 15. A=10, B=11, C=12, D=13, E=14, F=15. Since base-16 needs 0-15, digits 0-9 alone are insufficient, so letters are used.
Computer transistors can only have two states: ON(1) or OFF(0). Due to this digital circuit characteristic, binary is the most natural and stable. All data and instructions are ultimately represented as combinations of 0s and 1s.
Computers represent negative numbers using Two's Complement notation. The most significant bit (MSB) serves as the sign bit; 1 means negative. For example, -1 in 8-bit is represented as 11111111. This method simplifies addition circuits.
A bit is a single 0 or 1, the smallest unit of data. A byte is a group of 8 bits, the basic unit for representing one character. 1 byte = 8 bits = 2 hexadecimal digits.
This converter supports positive integers only. For negative or floating-point conversions, refer to IEEE 754 standard. Very large numbers may not be accurate due to browser number precision limits. When using in programming, check the maximum value for your language's integer types.
A numeral system is a set of rules for representing numbers, where the available digits are determined by the base. The decimal system (base 10) we use daily employs 10 digits (0-9), with each position representing a power of 10. Computers use binary (base 2) internally because they can only distinguish two states: ON and OFF. All data, programs, colors, and audio are ultimately stored and processed as binary combinations of 0s and 1s.
Binary is essential for bit operations, flag settings, and network subnet mask calculations. Hexadecimal represents 4 bits per digit, making long binary numbers concise, and is widely used for memory addresses, CSS color codes (#FF5733), and hash values. Octal is primarily used in Unix/Linux file permission systems (chmod 755), grouping 3 bits per digit. In programming, prefixes 0b (binary), 0o (octal), and 0x (hexadecimal) denote each base.
Base conversion is a core concept in computer science, applied across nearly all fields including CPU architecture, memory management, network protocols, and encryption. For example, performing an AND operation between an IPv4 address (192.168.1.1) and a subnet mask requires converting decimal to binary. Converting RGB color values to hexadecimal CSS codes or representing Unicode code points in hex are everyday examples of base conversion. Understanding number systems is foundational for writing efficient code and developing hardware-level debugging skills.