Binary Converter
Convert between binary, decimal, hexadecimal, and octal in real-time. Type in any field and all others update instantly.
ASCII Quick Reference
| Char | Dec | Hex | Binary | Char | Dec | Hex | Binary |
|---|---|---|---|---|---|---|---|
| Space | 32 | 20 | 00100000 | ! | 33 | 21 | 00100001 |
| 0 | 48 | 30 | 00110000 | 9 | 57 | 39 | 00111001 |
| A | 65 | 41 | 01000001 | Z | 90 | 5A | 01011010 |
| a | 97 | 61 | 01100001 | z | 122 | 7A | 01111010 |
| \n | 10 | A | 00001010 | \t | 9 | 9 | 00001001 |
| @ | 64 | 40 | 01000000 | # | 35 | 23 | 00100011 |
| $ | 36 | 24 | 00100100 | % | 37 | 25 | 00100101 |
| & | 38 | 26 | 00100110 | * | 42 | 2A | 00101010 |
What Is a Number Base?
A number base (or radix) determines how many unique digits are used to represent numbers. The most common bases in computing are binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Each base has specific use cases in programming, networking, and digital electronics.
Binary (Base 2)
Binary uses only two digits: 0 and 1. It is the fundamental language of computers. Every piece of data in a computer is ultimately represented as a sequence of binary digits (bits). Each bit position represents a power of 2, from right to left: 1, 2, 4, 8, 16, 32, and so on.
Hexadecimal (Base 16)
Hexadecimal uses digits 0-9 and letters A-F. It is commonly used in programming to represent memory addresses, color codes (like #FF5733), and byte values. Each hex digit maps exactly to 4 binary bits, making it a compact way to write binary data.
Octal (Base 8)
Octal uses digits 0-7. It is used in Unix/Linux file permissions (like chmod 755) and some legacy computing systems. Each octal digit represents exactly 3 binary bits.
How to Convert Between Number Bases
- Binary to Decimal:Multiply each bit by its positional power of 2, then sum the results. For example, 1010 = 1×8 + 0×4 + 1×2 + 0×1 = 10.
- Decimal to Binary: Repeatedly divide by 2 and record the remainders from bottom to top.
- Binary to Hex: Group binary digits in sets of 4 from right to left, then convert each group to its hex equivalent.
- Binary to Octal: Group binary digits in sets of 3 from right to left, then convert each group.
Two's Complement
Two's complement is the standard method for representing negative numbers in binary. To find the two's complement of a number, invert all the bits and add 1. For example, -5 in 8-bit two's complement is 11111011. This tool automatically shows two's complement representation when you enter a negative number.
Common Use Cases
- Debugging memory addresses and register values in low-level programming.
- Understanding bit manipulation operations (AND, OR, XOR, shifts).
- Working with network subnets and IP address calculations.
- Converting color codes between hex and RGB values.
- Setting Unix file permissions using octal notation.