Text to Binary Converter & Binary Translator
Type text to get binary, or paste binary to read it as text. Hex, decimal, octal and Unicode code points work too, in UTF-8, UTF-16 or Latin-1. Everything runs in your browser.
The characters of your text appear here.
How text becomes binary
A computer can only store numbers, so every character has a number. The letter A is 65, a is 97, a space is 32 and the digit 0 is 48. These numbers come from ASCII (1963), and Unicode kept them and added numbers for every other script and for emoji.
To store the number, it is written in base 2 and saved as one or more bytes of 8 bits. 65 is 64 + 1, so A is 01000001. The rule that turns a Unicode number into bytes is the encoding. Almost the whole web uses UTF-8.
Example: "Hi!"
| Character | Number | Binary | Hex |
|---|---|---|---|
| H | 72 = 64 + 8 | 01001000 | 48 |
| i | 105 = 64 + 32 + 8 + 1 | 01101001 | 69 |
| ! | 33 = 32 + 1 | 00100001 | 21 |
So "Hi!" is 01001000 01101001 00100001. Capital and small letters are exactly 32 apart, so they differ in one bit: H is 01001000 and h is 01101000.
How to read binary as text by hand
- Split the bits into bytes of 8, from the left:
0100100001101001becomes01001000and01101001. If the count is not a multiple of 8, check for a missing digit, or try groups of 7 (old 7-bit ASCII). - Turn each byte into a number. The 8 places are worth 128, 64, 32, 16, 8, 4, 2 and 1. Add the places where the bit is 1:
01001000= 64 + 8 = 72. - Look the number up in the ASCII table below: 72 is H, 105 is i.
- Bytes that start with 110, 1110 or 11110 begin a UTF-8 character of 2, 3 or 4 bytes (é, €, emoji). Those need the converter above, or the number base converter and some patience.
ASCII, UTF-8 and UTF-16 compared
The same character gives different bytes in different encodings. This is why a text can turn into "é" or "�" when it is read with the wrong one.
| Character | Code point | UTF-8 | UTF-16 BE | Latin-1 |
|---|---|---|---|---|
| A | U+0041 | 41 (1 byte) | 00 41 | 41 |
| é | U+00E9 | C3 A9 (2 bytes) | 00 E9 | E9 |
| € | U+20AC | E2 82 AC (3 bytes) | 20 AC | not possible |
| 中 | U+4E2D | E4 B8 AD (3 bytes) | 4E 2D | not possible |
| 😀 | U+1F600 | F0 9F 98 80 (4 bytes) | D8 3D DE 00 | not possible |
- ASCII: 128 characters (0–127), English only. Every ASCII text is also valid UTF-8 with the same bytes.
- UTF-8: 1 to 4 bytes per character. Used by about 98% of web pages, by Linux and macOS files, JSON and most APIs.
- UTF-16: 2 or 4 bytes per character. Used inside Windows, Java, JavaScript and C# strings. BE and LE are the two byte orders.
- Latin-1 (ISO-8859-1): 1 byte per character, 256 characters for Western European languages. Windows-1252 is almost the same, but uses 128–159 for € and curly quotes.
ASCII table with binary, hex and decimal
The 95 printable ASCII characters. Code 32 is the space. Codes 0–31 and 127 are control codes: the most common are 9 (tab), 10 (new line, LF), 13 (carriage return, CR) and 0 (NUL).
| Char | Decimal | Hex | Binary | Octal |
|---|---|---|---|---|
| (space) | 32 | 20 | 00100000 | 040 |
| ! | 33 | 21 | 00100001 | 041 |
| " | 34 | 22 | 00100010 | 042 |
| # | 35 | 23 | 00100011 | 043 |
| $ | 36 | 24 | 00100100 | 044 |
| % | 37 | 25 | 00100101 | 045 |
| & | 38 | 26 | 00100110 | 046 |
| ' | 39 | 27 | 00100111 | 047 |
| ( | 40 | 28 | 00101000 | 050 |
| ) | 41 | 29 | 00101001 | 051 |
| * | 42 | 2A | 00101010 | 052 |
| + | 43 | 2B | 00101011 | 053 |
| , | 44 | 2C | 00101100 | 054 |
| - | 45 | 2D | 00101101 | 055 |
| . | 46 | 2E | 00101110 | 056 |
| / | 47 | 2F | 00101111 | 057 |
| 0 | 48 | 30 | 00110000 | 060 |
| 1 | 49 | 31 | 00110001 | 061 |
| 2 | 50 | 32 | 00110010 | 062 |
| 3 | 51 | 33 | 00110011 | 063 |
| 4 | 52 | 34 | 00110100 | 064 |
| 5 | 53 | 35 | 00110101 | 065 |
| 6 | 54 | 36 | 00110110 | 066 |
| 7 | 55 | 37 | 00110111 | 067 |
| 8 | 56 | 38 | 00111000 | 070 |
| 9 | 57 | 39 | 00111001 | 071 |
| : | 58 | 3A | 00111010 | 072 |
| ; | 59 | 3B | 00111011 | 073 |
| < | 60 | 3C | 00111100 | 074 |
| = | 61 | 3D | 00111101 | 075 |
| > | 62 | 3E | 00111110 | 076 |
| ? | 63 | 3F | 00111111 | 077 |
| @ | 64 | 40 | 01000000 | 100 |
| A | 65 | 41 | 01000001 | 101 |
| B | 66 | 42 | 01000010 | 102 |
| C | 67 | 43 | 01000011 | 103 |
| D | 68 | 44 | 01000100 | 104 |
| E | 69 | 45 | 01000101 | 105 |
| F | 70 | 46 | 01000110 | 106 |
| G | 71 | 47 | 01000111 | 107 |
| H | 72 | 48 | 01001000 | 110 |
| I | 73 | 49 | 01001001 | 111 |
| J | 74 | 4A | 01001010 | 112 |
| K | 75 | 4B | 01001011 | 113 |
| L | 76 | 4C | 01001100 | 114 |
| M | 77 | 4D | 01001101 | 115 |
| N | 78 | 4E | 01001110 | 116 |
| O | 79 | 4F | 01001111 | 117 |
| P | 80 | 50 | 01010000 | 120 |
| Q | 81 | 51 | 01010001 | 121 |
| R | 82 | 52 | 01010010 | 122 |
| S | 83 | 53 | 01010011 | 123 |
| T | 84 | 54 | 01010100 | 124 |
| U | 85 | 55 | 01010101 | 125 |
| V | 86 | 56 | 01010110 | 126 |
| W | 87 | 57 | 01010111 | 127 |
| X | 88 | 58 | 01011000 | 130 |
| Y | 89 | 59 | 01011001 | 131 |
| Z | 90 | 5A | 01011010 | 132 |
| [ | 91 | 5B | 01011011 | 133 |
| \ | 92 | 5C | 01011100 | 134 |
| ] | 93 | 5D | 01011101 | 135 |
| ^ | 94 | 5E | 01011110 | 136 |
| _ | 95 | 5F | 01011111 | 137 |
| ` | 96 | 60 | 01100000 | 140 |
| a | 97 | 61 | 01100001 | 141 |
| b | 98 | 62 | 01100010 | 142 |
| c | 99 | 63 | 01100011 | 143 |
| d | 100 | 64 | 01100100 | 144 |
| e | 101 | 65 | 01100101 | 145 |
| f | 102 | 66 | 01100110 | 146 |
| g | 103 | 67 | 01100111 | 147 |
| h | 104 | 68 | 01101000 | 150 |
| i | 105 | 69 | 01101001 | 151 |
| j | 106 | 6A | 01101010 | 152 |
| k | 107 | 6B | 01101011 | 153 |
| l | 108 | 6C | 01101100 | 154 |
| m | 109 | 6D | 01101101 | 155 |
| n | 110 | 6E | 01101110 | 156 |
| o | 111 | 6F | 01101111 | 157 |
| p | 112 | 70 | 01110000 | 160 |
| q | 113 | 71 | 01110001 | 161 |
| r | 114 | 72 | 01110010 | 162 |
| s | 115 | 73 | 01110011 | 163 |
| t | 116 | 74 | 01110100 | 164 |
| u | 117 | 75 | 01110101 | 165 |
| v | 118 | 76 | 01110110 | 166 |
| w | 119 | 77 | 01110111 | 167 |
| x | 120 | 78 | 01111000 | 170 |
| y | 121 | 79 | 01111001 | 171 |
| z | 122 | 7A | 01111010 | 172 |
| { | 123 | 7B | 01111011 | 173 |
| | | 124 | 7C | 01111100 | 174 |
| } | 125 | 7D | 01111101 | 175 |
| ~ | 126 | 7E | 01111110 | 176 |
Text to binary in code
| Language | Text to binary (UTF-8) | Binary to text |
|---|---|---|
| JavaScript | [...new TextEncoder().encode(s)].map(b => b.toString(2).padStart(8, '0')).join(' ') | new TextDecoder().decode(new Uint8Array(bits.split(' ').map(b => parseInt(b, 2)))) |
| Python | ' '.join(f'{b:08b}' for b in s.encode()) | bytes(int(b, 2) for b in bits.split()).decode() |
| Java | String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0') for each byte of s.getBytes(UTF_8) | (byte) Integer.parseInt(bits, 2) per byte, then new String(bytes, UTF_8) |
| C# | string.Join(" ", Encoding.UTF8.GetBytes(s).Select(b => Convert.ToString(b, 2).PadLeft(8, '0'))) | Encoding.UTF8.GetString(bits.Split(' ').Select(b => Convert.ToByte(b, 2)).ToArray()) |
| Go | for _, b := range []byte(s) { fmt.Printf("%08b ", b) } | strconv.ParseUint(bits, 2, 8) per byte |
| Linux / macOS | echo -n "Hi" | xxd -b | echo "48 69" | xxd -r -p (hex) |
Frequently asked questions
How do I convert text to binary?
Look up the number of each character and write that number in base 2 with 8 digits. In ASCII and UTF-8, H is 72, which is 01001000, and i is 105, which is 01101001, so "Hi" is 01001000 01101001. Type any text in the box above and the binary appears as you type.
How do I convert binary to text?
Split the binary into groups of 8 bits (one byte each). Turn each group into a number by adding the place values 128, 64, 32, 16, 8, 4, 2 and 1 where the bit is 1, then look the number up in the ASCII table. 01000001 is 64 + 1 = 65, which is the letter A. Paste binary into the second box above to read it as text.
What is "Hello" in binary?
"Hello" is 01001000 01100101 01101100 01101100 01101111 in binary (ASCII or UTF-8). In hex it is 48 65 6C 6C 6F, and in decimal 72 101 108 108 111. Capital H (01001000) and small h (01101000) differ in only one bit.
What is "I love you" in binary?
"I love you" is 01001001 00100000 01101100 01101111 01110110 01100101 00100000 01111001 01101111 01110101. That is 10 bytes: 8 letters and 2 spaces (00100000). In hex it is 49 20 6C 6F 76 65 20 79 6F 75.
Why is one letter 8 bits?
Computers store text in bytes, and one byte is 8 bits. ASCII, the original code for English letters, digits and symbols, needs only 7 bits (128 characters), so the first bit of an ASCII byte is always 0. Some puzzles write 7-bit groups; this converter also reads those.
Why do é, Chinese characters and emoji give more bytes?
One byte can only hold 256 different values, but Unicode has more than 150,000 characters. UTF-8, the encoding used on almost every web page, keeps ASCII at 1 byte and uses 2 bytes for letters such as é, 3 bytes for most Chinese, Japanese and Korean characters and the euro sign, and 4 bytes for emoji. "é" is 11000011 10101001 in UTF-8.
What is the difference between ASCII, Unicode and UTF-8?
ASCII is a list of 128 characters with numbers 0 to 127. Unicode is the big list that gives a number (a code point, such as U+00E9 for é) to every character in every script; its first 128 numbers are the same as ASCII. UTF-8 and UTF-16 are ways to store those numbers as bytes. For plain English text, ASCII and UTF-8 give exactly the same binary.