Text to Binary Converter

Convert text to binary, hex, octal or decimal bytes and back, with full UTF-8 support for emoji and every language.

1
1
Characters: 12Bytes: 12

Character by character

CharacterCode pointUTF-8 bytes
HU+004801001000
eU+006501100101
lU+006C01101100
lU+006C01101100
oU+006F01101111
SpaceU+002000100000
wU+007701110111
oU+006F01101111
rU+007201110010
lU+006C01101100
dU+006401100100
!U+002100100001
Mode

Converts text to the bytes a computer stores for it β€” written in binary, hex, octal or decimal β€” and turns those bytes back into text. It encodes as UTF-8, so accented letters, non-Latin scripts and emoji come out exactly as a file or web page would hold them, and a table shows every character with its code point and bytes.

How to use it

Choose Encode to turn text into bytes or Decode to turn bytes into text, and pick the format: binary (the default), hex, octal or decimal. When encoding, binary is padded to 8 bits, hex to two digits and octal to three, and a separator goes between bytes: a space (the default), a comma or a new line. Binary and hex can also be written with no separator, and hex bytes with a 0x prefix.

When decoding, bytes may be separated by spaces, new lines or commas, each with an optional 0b, 0x or 0o prefix. Binary and hex may also run together, as long as the length divides into whole bytes; decimal and octal bytes vary in length, so they need separators. A byte the tool cannot read is named by its position.

Below the output, the counts give characters (code points) and bytes. When encoding, the first 200 characters are listed one by one. Everything runs in your browser.

Bytes, not characters

UTF-8 stores each character in one to four bytes. The 128 ASCII characters β€” unaccented English letters, digits and common punctuation β€” take one byte each, so β€œA” is 01000001. Other characters take more: β€œΓ©β€ is 2 bytes, β€œβ‚¬β€ 3 and an emoji 4.

Some converters skip UTF-8 and write each character’s code directly. For β€œΓ©β€ that gives the single byte 11101001, which is not valid UTF-8: decoded here it shows as β€œοΏ½β€. Emoji fare worse, since such tools work in UTF-16 units and split each emoji into two halves that are not characters on their own.

A character here is a Unicode code point, which is not always what looks like one character. The family emoji πŸ‘¨β€πŸ‘©β€πŸ‘§ is three people joined by zero-width joiners: 5 code points and 18 bytes.

Examples

A greeting

β€œHi” is 2 characters and 2 bytes, in binary 01001000 01101001.

An accented letter

β€œΓ©β€ is one character and 2 bytes, in binary 11000011 10101001.

An emoji

β€œπŸ˜€β€ is one character and 4 bytes, in hex F0 9F 98 80.

ASCII letters and digits in binary

Each character is one byte in UTF-8
CharacterBinaryCharacterBinaryDigitBinary
A01000001a01100001000110000
B01000010b01100010100110001
C01000011c01100011200110010
D01000100d01100100300110011
E01000101e01100101400110100
F01000110f01100110500110101
G01000111g01100111600110110
H01001000h01101000700110111
I01001001i01101001800111000
J01001010j01101010900111001
K01001011k01101011
L01001100l01101100
M01001101m01101101
N01001110n01101110
O01001111o01101111
P01010000p01110000
Q01010001q01110001
R01010010r01110010
S01010011s01110011
T01010100t01110100
U01010101u01110101
V01010110v01110110
W01010111w01110111
X01011000x01111000
Y01011001y01111001
Z01011010z01111010

The standard

UTF-8 is defined in RFC 3629: each Unicode code point is encoded in one to four bytes, and the first 128 code points match ASCII byte for byte. Decoding follows the same rules, and any byte sequence they do not allow is replaced with U+FFFD, the replacement character, with a note that some bytes are not valid UTF-8.

Sources

Reviewed

See also