Text to Binary Converter
Type text and get its bytes as 8-bit binary. Switch the direction to turn binary back into text.
https://flxcode.com/text-to-binary/
Example
5 characters became 5 bytes.
Character by character
| Char | Code point | UTF-8 bytes | Size |
|---|---|---|---|
| H | U+0048 | 01001000 | 1 |
| e | U+0065 | 01100101 | 1 |
| l | U+006C | 01101100 | 1 |
| l | U+006C | 01101100 | 1 |
| o | U+006F | 01101111 | 1 |
How it works
- Every character has a number (its Unicode code point). UTF-8 turns that number into 1 to 4 bytes.
- This text has 5 characters and 5 bytes: plain ASCII uses one byte per character.
- A byte is 8 bits. The top bit of an ASCII byte is always 0.
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Worked examples
| Text | Binary (UTF-8 bytes) | Note |
|---|---|---|
| A | 01000001 | Upper case A is 65, lower case a is 97: they differ by one bit |
| a | 01100001 | The 0x20 bit marks lower case |
| Hi! | 01001000 01101001 00100001 | Three characters, three bytes |
| é | 11000011 10101001 | One character, two bytes in UTF-8 |
| € | 11100010 10000010 10101100 | Three bytes |
| 😀 | 11110000 10011111 10011000 10000000 | Four bytes for an emoji |
The same Hello in hex is 48 65 6C 6C 6F. And 01010100 01101000 ... decodes to The one.
How UTF-8 packs a character
| Bytes | Pattern | Range |
|---|---|---|
| 1 | 0xxxxxxx | U+0000 to U+007F (ASCII) |
| 2 | 110xxxxx 10xxxxxx | U+0080 to U+07FF |
| 3 | 1110xxxx 10xxxxxx 10xxxxxx | U+0800 to U+FFFF |
| 4 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | U+10000 to U+10FFFF |
The x bits hold the character's number. The leading bits of each byte tell a reader how many bytes belong together.
Other conversions
The number of any single byte can be read in other bases with the number base converter. To count how many characters your text has before you encode it, try the character counter, and the case converter changes upper and lower case, which is the one bit in the table above.
Numbers this uses
- Encoding: UTF-8 (the browser's TextEncoder), the encoding of most web pages and files today.
- Binary uses 8 bits per byte with leading zeros. Hex uses 2 digits, octal 3, decimal 0 to 255.
- Limit: 5,000 characters in, 5,000 bytes in the other direction.
- Bytes that are not valid UTF-8 are refused, not replaced with a question mark.
Nothing you type is uploaded. We count events without cookies (details).
FAQ
How do I convert text to binary?
Turn each character into its number, then write the number as 8 bits. H is 72 and 72 in binary is 01001000. The tool does this for the whole text at once and puts a space between the bytes. Pick hex, decimal or octal if you need the bytes in another form.
What is UTF-8 and why does é take two bytes?
UTF-8 is the usual way to store Unicode text. The 128 ASCII characters use one byte. Letters like é, ü or ж use two bytes, characters like € or 中 use three, and emoji use four. So the number of bytes can be larger than the number of characters, and the tool shows both.
Can I turn binary back into text?
Yes. Switch Direction to Binary to text and paste the bytes. Groups of 8 bits separated by spaces, or one long string whose length is a multiple of 8, both work. The tool decodes them as UTF-8. In decimal, hex and octal mode it reads bytes in that form instead.
Why does it say my bytes are not valid UTF-8?
UTF-8 has rules. A byte that starts with 110 must be followed by one continuation byte that starts with 10, 1110 by two, 11110 by three. If a byte is missing, cut off or from another encoding such as Latin-1, the text can not be read, so the tool refuses to guess and shows an error.
Is this the same as ASCII?
For the English letters, digits and punctuation, yes: the bytes are identical. ASCII only has 128 characters, one byte each with the top bit 0. UTF-8 keeps those bytes and adds the other characters on top, which is why plain English text looks the same in both.
Is there a limit on length?
Up to 5,000 characters or bytes at a time. The table below the result lists the first 40 characters, with their code points and bytes. The result box has all of the bytes and the copy button copies all of them.
What do spaces and new lines turn into?
A space is the byte 00100000 (32) and a new line is 00001010 (10). They are characters like any other, so they appear in the output. A tab is 00001001 (9).
Is my text saved or sent anywhere?
No. The text is converted in your browser. What you type is not put in the address bar, not stored and not counted. We only count whether you converted text to bytes or bytes to text.
More from FLXCode
Number Base ConverterNew
Convert any number between bases 2 and 36, exact with BigInt. Negative and fractional input, bits grouped by 4.
Case ConverterNew
Change text to sentence case, Title Case, UPPERCASE, camelCase, snake_case and more. Copy any result.
Character CounterNew
Count characters with and without spaces. Check X, Bluesky, SMS, YouTube and Google limits, with emoji counted right.
Word CounterNew
Count words, characters, sentences and paragraphs as you type. Reading and speaking time with speeds you can change.