Answer: The Binary / Hex Converter produces your output instantly from the input you provide — everything runs in your browser, free, with no signup required.
Convert between number bases and encode text as binary
This binary converter translates numbers between binary (base 2), decimal (base 10), hexadecimal (base 16), and octal (base 8), and also converts text to binary and back. It handles arbitrary-length integers, so it works equally well for a homework exercise and for checking a 64-bit value.
Number bases are just different ways of writing the same quantity using different numbers of digits. Binary uses only 0 and 1 because it maps directly onto two-state hardware; hexadecimal packs exactly four binary digits into one symbol (0–9, A–F), which is why memory dumps and color codes use it; octal groups three bits and survives in Unix file permissions. Once you can read one base, the others follow the same positional logic.
Every positional number is a sum of digit × baseᵏ terms. Decimal 202 breaks down as 1×128 + 1×64 + 0×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1, which is why its binary form is 11001010. In hexadecimal the same value is CA (12×16 + 10), and in octal it is 312 (3×64 + 1×8 + 2).
To convert by hand from decimal, divide repeatedly by the target base and read the remainders bottom-to-top. To convert from binary to hex, split the bits into groups of four from the right and translate each group with the table below — this shortcut is why programmers read hex fluently.
The table below lists the sixteen hexadecimal symbols with their decimal and binary values. Memorizing just this one table makes binary↔hex conversion instant, since every hex digit is exactly four bits.
| Hex | Dec | Binary | Hex | Dec | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 1 | 1 | 0001 |
| 2 | 2 | 0010 | 3 | 3 | 0011 |
| 4 | 4 | 0100 | 5 | 5 | 0101 |
| 6 | 6 | 0110 | 7 | 7 | 0111 |
| 8 | 8 | 1000 | 9 | 9 | 1001 |
| A | 10 | 1010 | B | 11 | 1011 |
| C | 12 | 1100 | D | 13 | 1101 |
| E | 14 | 1110 | F | 15 | 1111 |
Binary is the machine's native language and appears in networking (subnet masks), and anywhere bit-level detail matters. Hexadecimal dominates programming: CSS colors such as #CA0000, memory addresses, MAC addresses, and hash digests are all hex. Octal survives mainly in Unix file permission notation such as 755.
Text-to-binary conversion uses a character encoding — each character maps to a fixed bit pattern (ASCII assigns 7- or 8-bit codes, while UTF-8 uses one to four bytes). The converter applies the same encoding rules your text editor does, so 'A' becomes 01000001 and the round trip returns exactly what you typed.
Signed integers need one extra idea: two's complement, the encoding virtually all modern hardware uses for negative numbers. The leftmost bit becomes a sign with value −(base^(n-1)) rather than +(base^(n-1)), so in 8 bits the pattern 11111111 represents −1, not 255, and the representable range becomes −128 to +127. This is why a counter that overflows at 127 in a program loops to a negative number — you are seeing two's complement arithmetic, not a bug in your conversion math.
Bitwise operations work directly on binary representation and are easiest to understand in hex. Shifting left by one bit doubles a value; shifting right halves it (rounding down for positive integers). The AND, OR, and XOR operators combine values bit by bit and are used for masks — an AND with 0x0F strips everything but the low four bits, which is exactly a modulo-16 operation. Subnetting works the same way: a netmask is an AND mask over the 32-bit address.
Floats are where binary surprises people. Binary can represent halves, quarters, and eighths exactly, but not tenths — 0.1 in binary is an infinitely repeating pattern, so it gets truncated to fit 64 bits. That is why 0.1 + 0.2 equals 0.30000000000000004 in most programming languages. Money should therefore be stored in integer cents, not floating-point dollars, and any comparison of computed floats needs a tolerance rather than equality.
Octal earned its historical place because early computers used 12-, 24-, and 36-bit words — divisible by three, so octal digits aligned perfectly. When 8-, 16-, and 32-bit machines arrived, hexadecimal took over because its 4-bit grouping aligned instead. You can still see both eras: Unix permissions (755) and some legacy languages use octal, while everything modern — color values, UUIDs, addresses, hashes — is hex.
How do I convert binary to decimal?
Add the place values of every 1 bit. For 11001010: 128 + 64 + 8 + 2 = 202.
How do I convert binary to hexadecimal?
Split the bits into groups of four from the right and translate each group. 11001010 becomes 1100 1010 = C A, so the hex value is CA.
Why do programmers use hexadecimal?
One hex digit is exactly four binary digits, so hex compresses long binary values cleanly — memory addresses, color codes, and hashes all become readable. Decimal has no such alignment with binary.
What is octal used for?
Octal groups three bits per digit and lives on mainly in Unix file permissions, such as chmod 755 for owner-read-write-execute.
How does text-to-binary work?
Each character is replaced by its encoding's bit pattern — in ASCII, 'A' is 01000001. UTF-8 extends the idea to one to four bytes per character, which is how it covers every language.