Text to binary converter
Translate text to binary — its UTF-8 bytes, eight digits each — and binary back to text, with the line and column of a character that does not belong.
01001000 01100101 01101100 01101100 01101111
How a text becomes ones and zeros
A computer keeps text as bytes, and a byte is eight bits, each of them a 0 or a 1. This page shows you those bytes: type a text and every byte comes out as eight binary digits, with a space between one byte and the next, or paste binary and read the text it spells. It works in both directions, it runs entirely in your browser, and it opens on an example that is already converted.
Which bytes a text is made of depends on its encoding, and here that is UTF-8 unless you choose otherwise, because UTF-8 is what web pages, URLs and most text files hold. The Unit selector decides what one group of digits stands for: a byte of UTF-8, a byte of UTF-16 in either byte order, or one code point. The Unit you choose holds in both directions, and the page never changes it for you. When what you paste looks like another Unit, it says so and puts a button beside the note, and nothing switches until you press it.
Why each byte is written with eight digits
A bit is one binary digit, and a byte is eight of them. Eight bits can be set in 256 ways, so a byte holds a whole number from 0, which is 00000000, to 255, which is 11111111. The byte is the unit files, memory and networks are counted in, and on any machine you are likely to meet it is eight bits; network standards call it an octet, a word that can only mean eight.
The first 128 of those values are ASCII, the code for the English letters, the digits and the common punctuation, and 128 values need only seven bits. So every ASCII character’s byte opens with a 0, and UTF-8 keeps the bytes that open with a 1 for everything ASCII does not have. The page writes every byte with all eight digits, leading zeros included, for a practical reason as well: bytes of one fixed width can be read back with no spaces between them, eight digits at a time.
The letter H, bit by bit
Take a capital H. ASCII numbers it 72, and 72 as a byte is 01001000. Read from the left, the eight places are worth 128, 64, 32, 16, 8, 4, 2 and 1, and every 1 counts its place: this byte has its ones in the places worth 64 and 8, and 64 and 8 make 72. A lowercase i is 105, which is 64, 32, 8 and 1, so Hi comes out as 01001000 01101001.
Case is one bit. A lowercase h is 01101000, the byte of H with the place worth 32 switched on, and the same is true of every letter of the English alphabet, because ASCII numbers each lowercase letter exactly 32 above its capital.
The Base selector writes the same byte in other ways without changing it. With Decimal chosen, H is 72; with Hexadecimal, 48; with Octal, 110. It is one byte written four ways, and reading takes the digits back in whichever Base you have chosen. The Text to hex converter opens on Hexadecimal, where a byte takes two digits rather than eight.
Why a letter past ASCII takes two bytes or more
ASCII ends at 127. An accented letter, a letter of the Cyrillic, Hebrew or Arabic alphabet, a Japanese or Korean character and an emoji all have code points past it, and UTF-8 writes a character in a single byte only when it is ASCII, keeping the bytes that open with a 1 for everything else. So each of these takes two, three or four bytes, and binary is where you can watch that happen, because the first bits of every byte say which part of a character the byte is:
- 0xxxxxxx is a character in one byte: ASCII, its seven bits written where the x stand. H is 01001000.
- 110xxxxx 10xxxxxx is a character in two bytes, for code points up to 2,047, which covers the accented letters of the European languages and the Cyrillic, Hebrew and Arabic alphabets. é is 11000011 10101001 and א is 11010111 10010000.
- 1110xxxx 10xxxxxx 10xxxxxx is three bytes, for code points up to 65,535, where Japanese kana and the common kanji, Korean Hangul and the euro sign stand. € is 11100010 10000010 10101100.
- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx is four bytes, for every code point past that, which is where most emoji are.
A first byte that opens with two, three or four ones says how many bytes its character has, and every byte that carries a character on opens with 10, so no byte from the middle of a character can be taken for the start of one. Strip the markers from the two bytes of א, the 110 and the 10, and the eleven bits left over, 10111010000, are its code point, U+05D0, in binary. With Hexadecimal chosen the same two bytes read D7 90, and the pattern is folded into the digits; in binary it stands in the first bits of every byte.
Four bytes for one emoji
😀 is U+1F600, well past 65,535, so UTF-8 writes it in four bytes: 11110000 10011111 10011000 10000000. The first opens with four ones, so it starts a character of four bytes, and each of the three after it opens with 10. Its code point takes seventeen binary digits, 11111011000000000, one more than the sixteen a three-byte character has room for; the four-byte pattern has room for twenty-one.
An emoji that looks like one symbol can be several code points, and each of them is written out in full. A waving hand with a skin tone is two code points and eight bytes. A family of four is seven code points, four people and the three invisible joiners between them, and twenty-five bytes. Paste one into the page and count the groups.
Why another converter prints eleven digits for א
A converter that prints eleven digits for א, 10111010000, has not written its bytes. It has written the number Unicode gives the letter, its code point U+05D0, which is 1488, as one binary number, and that number is not a byte of anything a file or a network holds. A message written that way can be read back only by a reader that makes the same assumption.
The two answers are closer than they look. The eleven digits are exactly the bits UTF-8 spreads over its two bytes once the markers are taken away, as shown above, so both converters write the same number, and only one of them writes the bytes that store it. On an ASCII character the two agree but for leading zeros, which is why they give the same answer for plain English and part ways on nearly everything else.
This page gives that answer too, as a Unit you choose rather than one it assumes: pick Code points and א is written as 10111010000, and read back the same way. Paste a message a code-point converter wrote in Hebrew, Russian or Japanese while UTF-8 is chosen, and the groups are too wide for bytes; the page does not guess, but says the groups look like code points and offers Switch to code points. A converter that works one UTF-16 code unit at a time, as JavaScript’s charCodeAt does, writes 😀 as two sixteen-digit numbers, the halves of the surrogate pair UTF-16 stores it as, and Code points reads the pair back as the one emoji.
Reading binary back as text
To turn binary back into text, switch the direction to Binary to text and type or paste the digits, and the output is the text they spell. Use as input does it in one click, moving the output into the input and turning the direction, which is the quickest way to check a round trip. All of these are read as the same bytes:
- White space of any kind, line breaks included, and commas, semicolons, colons or hyphens between the bytes.
- No separators at all, wherever the digits split into whole bytes of eight, which is how Compact under Style writes them.
- Groups of seven digits or fewer, which is how an ASCII character looks with its leading zero dropped: 1001000 1101001 reads as Hi.
- A 0b in front of a byte, in either case, and one pair of brackets, braces, parentheses or quotes around the whole.
It does not guess, though. Any other character, or a group longer than eight digits that does not split into whole bytes, stops the reading, and the page says so with the line and column where it stands, your own line shown beneath with the place marked. In a long message that is the difference between a typo you can find and a text that is quietly wrong.
Binary that reads cleanly as bytes but is not UTF-8 text is shown rather than refused. A message cut short in the middle of a character comes back with the broken sequence shown as U+FFFD, the replacement character, and a note under the output says how many such sequences there are and where the first one begins: the byte, the digits you pasted for it, and their line and column.
Binary for a text, and binary for a number
Type 5 here and the answer is 00110101, not 101. The page writes the character 5, which ASCII numbers 53, because a text’s digits are the bytes that store it; 101 is the number five written in binary, which is a different question with a different answer. The same goes for 255: typed here it is three characters and three bytes, where the number 255 is the single byte 11111111.
When what you have is a number rather than a text, such as a count, a register or a value a program printed, the Number base converter is where to take it: it converts the value itself between binary, octal, decimal, hexadecimal and other bases, and at a fixed width it writes a negative value in two’s complement and shows every bit as one you can click to flip. This page starts from the characters of a text; that one starts from a number.
Frequently asked questions
- How do I write my name in binary?
- Type it into the input box and it comes out a byte at a time, eight digits to a byte with a space between bytes. Ada, for example, is 01000001 01100100 01100001. A letter with an accent, or one from another alphabet, takes two bytes or more, and a space between two names is a byte of its own, 00100000.
- How many bits does one character take?
- In UTF-8, eight for an ASCII letter, digit or punctuation mark, sixteen for an accented letter or a Cyrillic, Hebrew or Arabic one, twenty-four for Japanese kana, the common kanji, Korean Hangul and the euro sign, and thirty-two for most emoji. Something you see as one symbol can be several code points underneath, and each of them takes its own bits.
- Can I paste binary with no spaces between the bytes?
- Yes, wherever the digits split into whole bytes: sixteen digits are two bytes and twenty-four are three. A group longer than eight digits whose length is not a multiple of eight cannot be split without guessing which byte lost a digit, so it is refused at its line and column instead of being read wrong.
- Why does my text come back with a question mark in a diamond?
- That symbol is U+FFFD, the replacement character, which the page puts wherever the bytes are not UTF-8 text: most often a byte was lost and a character cut short, or the bytes were never UTF-8 at all. Rather than refuse the whole message, the page shows each broken sequence that way and says under the output how many there are and where the first one begins, so you can find the damage in what you pasted.
- Why does another converter give me different binary?
- Most likely it writes each character’s code point rather than its bytes. The two agree on ASCII but for leading zeros, and differ past it: א is 11010111 10010000 here and 10111010000 there. Choose Code points to get that converter’s answer, or to read back a message it wrote.
- Why is 5 not 101 here?
- Because a 5 typed into the box is a character, and the page writes the byte that stores it, 00110101. The number five is 101 in binary; for a number rather than a text, use the Number base converter.
- Is my text sent to a server?
- No. Both directions run entirely in your browser, so the text you type and the binary you paste never leave your device.
Related tools
- Number base converter
Type 5 on this page and you get the byte that stores the character 5, 00110101. That page is for a number rather than a text: it converts the value itself, so five comes out as 101.
- Text to hex converter
Hex writes a byte in two digits where binary takes eight — Hi is 01001000 01101001 here and 48 69 there — which is how a dump shows bytes and how code writes them. This page offers hex too; that page opens on it.
- Base64
Encode and decode Base64 — full UTF-8 support.
- URL encoder / decoder
Percent-encode a value or a whole URL, and back.