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.