Binary Converter

Convert a number between binary, decimal, hexadecimal and octal - every base updates live - plus turn text into UTF-8 binary and back.

Number bases (edit any field)

Whole non-negative numbers only. Binary of a negative number is not well defined without a fixed bit width.


Text and binary (UTF-8)

Reading binary, hex and octal

A number base just decides how many symbols you count with before rolling over. Decimal uses ten (0-9), binary uses two (0-1), octal uses eight (0-7) and hexadecimal uses sixteen (0-9 then A-F). The value is the same in every base - only the way it is written changes. 42 in decimal is 101010 in binary, 2A in hex and 52 in octal. Edit any box above and the other three update instantly.

Why programmers use hex and octal

Binary is precise but long. Because 16 and 8 are both powers of two, hex and octal act as shorthand: one hex digit is exactly four bits and one octal digit is exactly three. That makes hex the natural choice for colors (#FF8800), byte values and memory addresses, where every group of four bits maps to a single tidy character.

How text becomes binary

Computers store text as numbers. UTF-8 encoding gives every character a code and writes it as one to four bytes, and each byte is eight bits. The word "Hi" is the bytes 72 and 105, or 01001000 01101001 in binary. Type into either text box below the numbers and watch it convert both ways - paste space-separated bytes into the binary box to decode a message back to readable text.

Related tools

For raw byte encoding of files and strings see the Base64 encoder, and for hashing use the hash generator. Converting storage units like KB and MB is the job of the data size converter.

Frequently asked questions

How do you convert binary to decimal?
Each binary digit is a power of two, doubling from right to left: 1, 2, 4, 8, 16 and so on. Add up the powers wherever there is a 1. For example 1011 is 8 + 0 + 2 + 1 = 11. The converter does this instantly for any of the four bases.
What is the difference between hexadecimal and octal?
Hexadecimal is base 16 (digits 0-9 then A-F) and each hex digit maps to exactly four binary bits, which is why it is used for colors and memory addresses. Octal is base 8 (digits 0-7) and each octal digit maps to three bits. Both are just shorter ways to write binary.
How is text turned into binary?
Each character is encoded to bytes using UTF-8, and each byte is written as eight binary digits. Plain English letters take one byte (for example "A" is 01000001), while emoji and accented characters take two to four bytes.
Why does my binary number lose its leading zeros?
Leading zeros do not change a value, so 00101 and 101 are both five. The converter shows the shortest correct form. In text-to-binary mode every byte is padded to a full eight bits so the bytes line up.