Binary & Hex Converter

Agarapu Ramesh — Editor and content reviewer

What This Calculator Does

This converter translates numbers between four number systems: Decimal (base 10), Binary (base 2), Hexadecimal (base 16), and Octal (base 8). Type a value in any field and the other three update instantly. It also includes a separate text-to-binary section that converts ASCII text into its binary byte representation.

Inputs Explained

How It Works

Each number system uses a different base (radix). Conversion involves interpreting the digits according to their positional value in the source base, computing the total value, and then re-expressing it in the target base. For text-to-binary, each character's ASCII code is converted to an 8-bit binary string, and the results are displayed space-separated.

Formulas Used

Decimal to Binary: Repeatedly divide by 2, record remainders (read bottom to top).
Binary to Decimal: Sum of (digit × 2^position) for each bit.
Decimal to Hex: Repeatedly divide by 16, map remainders 10–15 to A–F.
ASCII to Binary: Character → char code (0–127) → 8-bit binary string.

Type in any field to convert instantly.


ASCII Text

Step-by-Step Example: Decimal 42 to Binary

Step 1: 42 ÷ 2 = 21 remainder 0

Step 2: 21 ÷ 2 = 10 remainder 1

Step 3: 10 ÷ 2 = 5 remainder 0

Step 4: 5 ÷ 2 = 2 remainder 1

Step 5: 2 ÷ 2 = 1 remainder 0

Step 6: 1 ÷ 2 = 0 remainder 1

Read remainders bottom-to-top: 101010

Hexadecimal: 42 ÷ 16 = 2 remainder 10 (A) → 2A

Octal: 42 ÷ 8 = 5 remainder 2 → 52

Step-by-Step Example: Text "Hi" to Binary

H: ASCII code 72 → binary 01001000

i: ASCII code 105 → binary 01101001

Result: 01001000 01101001

Use Cases

Assumptions and Limitations

Frequently Asked Questions

Divide the decimal number by 2 repeatedly, writing down the remainder each time, until you reach 0. Then read the remainders bottom to top — that's your binary number. So for 13: 13÷2 gives 6 remainder 1, 6÷2 gives 3 remainder 0, 3÷2 gives 1 remainder 1, 1÷2 gives 0 remainder 1. Reading bottom to top: 1101. Binary uses only 0 and 1, so each digit (called a bit) represents a power of two: 1101 = 8 + 4 + 0 + 1 = 13. The calculator handles all this automatically.
0 Each binary digit represents a power of 2, starting from 2 on the right. Multiply each bit by its position value, then add them up. So binary 1101 becomes (1×8) + (1×4) + (0×2) + (1×1) = 13. For longer numbers like 10110010, work right to left: 0+2+0+0+16+32+0+128 = 178. The pattern is: rightmost bit is 1, next is 2, then 4, 8, 16, 32, 64, 128 — doubling each time. With practice you can do small numbers in your head, but the calculator is faster for anything over 8 bits.
Binary is base 2 — only two digits (0 and 1), one for each on/off state of a circuit. Hexadecimal is base 16, using digits 0-9 and letters A-F (where A=10, B=11, up to F=15). The reason both exist is that binary is what computers actually use, but it's painful for humans to read — eight bits like 11010110 is just 0xD6 in hex, which is much shorter. One hex digit perfectly represents four binary bits, so converting between them is mechanical. Programmers use hex constantly for memory addresses, colours, byte values and bitmasks.
Each character has an ASCII (or Unicode) code number. Convert that number to its 8-bit binary representation, and string the results together. So "Hi" becomes "H" (ASCII 72 = 01001000) followed by "i" (ASCII 105 = 01101001), giving 01001000 01101001. The standard width is 8 bits per character because ASCII fits inside one byte. For Unicode characters beyond basic ASCII (like Indian language scripts or emoji), you'd usually use UTF-8, which uses 1 to 4 bytes per character. Most converter tools handle both — just paste your text and pick the encoding.
ASCII (American Standard Code for Information Interchange) maps each character to a number from 0 to 127. ASCII binary is just that number written in 8-bit binary form. So uppercase A is ASCII 65, which becomes 01000001 in binary. Lowercase a is ASCII 97, or 01100001. The space character is 32, or 00100000. Each character takes one byte (8 bits), with the leftmost bit always being 0 in standard ASCII. Extended ASCII and Unicode build on this with more characters, but plain ASCII is still the foundation of how text is stored on virtually every computer.
Each hex digit represents a value (0-9 are themselves; A=10, B=11, C=12, D=13, E=14, 0 F=15) multiplied by a power of 16, starting from 16 on the right. So 2F in hex becomes (2×16) + (15×1) = 32 + 15 = 47. For longer numbers like 1A3, it's (1×256) + (10×16) + (3×1) = 256 + 160 + 3 = 419. The pattern: rightmost digit is multiplied by 1, next by 16, then 256, then 4096, multiplying by 16 each step. The calculator does this instantly, especially helpful for longer hex strings.
Group your binary digits in sets of four, starting from the right. Add zeros on the left if the leftmost group is short. Then convert each group of four bits into one hex digit using the standard mapping (0000=0, 0001=1, ..., 1010=A, ..., 1111=F). So binary 11010110 splits into 1101 and 0110, which become D and 6 — giving D6 in hex. For 101101110, you'd pad to 000101101110, then group as 0001, 0110, 1110, giving 16E. This works because hex is essentially compressed binary — one hex digit fits exactly four bits.
Electronic circuits work most reliably with two distinct states — on or off, high voltage or low voltage, charged or uncharged. Binary maps perfectly onto this: 1 for on, 0 for off. Trying to represent ten different voltage levels for decimal would need much more sensitive circuitry, and small fluctuations would cause errors. With just two states, the gap between "on" and "off" is huge, so noise rarely causes confusion. Every layer of computing — transistors, memory cells, network signals, storage media — is built on this binary foundation, even though we display the results in decimal.
Octal is base 8, using digits 0 through 7. It was popular in early computing because three binary bits map exactly to one octal digit, making it convenient for systems with byte sizes that were multiples of three bits. Today, hexadecimal has largely replaced octal because four-bit groupings fit modern 8-bit bytes more cleanly. The main place you still see octal is in Unix and Linux file permissions — chmod 755 uses octal to set read/write/execute flags. C and Python also accept octal literals (prefixed with 0o or just 0), but it's mostly a niche tool now.
Mathematically, leading zeros don't change a number's value — 00001101 means the same as 1101. But computers and binary tools usually pad to a fixed width because bytes have a defined size (8 bits, 16 bits, 32 bits and so on). When converting text to binary, every character gets a full 8-bit byte even if its number is small, so capital A becomes 01000001 instead of just 1000001. The padding makes the output align nicely, easier to read in groups, and matches how the data is actually stored in memory. The calculator usually shows both.

Sources and References

Related Calculators