How to use it
- Choose “Text → bytes” to encode or “Bytes → text” to decode.
- Pick a byte format: binary, hexadecimal, decimal or octal.
- Type or paste your input. The result and the byte count update as you type.
- Copy the result, or swap it into the input to check the round trip.
How it works
Computers store text as bytes. This tool uses UTF-8, the encoding used by almost every website and modern system. In UTF-8, the 128 ASCII characters (English letters, digits and basic punctuation) take one byte each, so H is 01001000 in binary and 48 in hexadecimal. All other characters take two to four bytes: é is 2 bytes (C3 A9), € and ☕ are 3 bytes, and most emoji are 4 bytes. That is why the byte count can be larger than the character count, and why one character can turn into several groups of 8 bits.
Each byte can be written in four common ways: 8-digit binary (00000000–11111111), 2-digit hexadecimal (00–FF), decimal (0–255) or 3-digit octal (000–377). When bytes are written without separators, binary, hex and octal values are padded to a fixed width, and decimal values are padded to 3 digits so they can be split again unambiguously.
Decoding is tolerant of formatting: spaces, line breaks, commas and semicolons between bytes are ignored, as are 0x and 0b prefixes and \x escapes. Every group is checked; a digit that is not allowed in the chosen format, or a value above 255, is reported with the position of the byte. After decoding, the bytes are checked for valid UTF-8, and you are told if they are not text.
Characters made of several code points, such as flags or emoji with skin tones, are counted as multiple characters here, because each code point is encoded separately.
Examples
The classic “Hi” in binary
H is ASCII 72 and i is 105, so “Hi” becomes 01001000 01101001 in binary, 48 69 in hex and 72 105 in decimal: 2 characters, 2 bytes, 16 bits.
Why “Café” is 5 bytes
C, a and f are one byte each, but é is two bytes in UTF-8: 11000011 10101001 (C3 A9). The word has 4 characters but takes 5 bytes, which matters for database column limits and protocol fields measured in bytes.
Reading a hex dump
A debugger shows 48 65 6c 6c 6f 2c 20 e4 b8 96 e7 95 8c. Paste it with “Bytes → text” and Hexadecimal to get “Hello, 世界”; each Chinese character is 3 bytes.
Frequently asked questions
Why does one character turn into 16, 24 or 32 bits?
In UTF-8 only ASCII characters fit in one byte (8 bits). Accented letters and most other alphabets use 2 bytes, Chinese, Japanese, Korean and many symbols use 3, and emoji use 4. Each byte is shown as its own group.
Is this ASCII or UTF-8?
UTF-8. For plain English text the result is identical to ASCII, because UTF-8 was designed to be compatible with it. Characters beyond ASCII would be impossible to represent in ASCII alone.
Why do I get an error when decoding binary?
Each byte must be at most 8 binary digits and contain only 0 and 1. Without spaces, the total number of digits must be a multiple of 8. The error message names the byte that could not be read.
What does “not valid UTF-8” mean?
The bytes do not form valid UTF-8 sequences, for example a lone byte above 127 or a sequence cut off in the middle. The data may come from a file in another encoding such as Windows-1252, or it may not be text at all.
Privacy
The conversion runs in your browser using its built-in UTF-8 encoder and decoder. Your text is not uploaded, stored or included in analytics.