Text to Binary

Convert text to binary code, with UTF-8 support and your choice of spacing.

  • Runs in your browser
  • Free, no sign-up
Type text to start

About the Text to Binary

Computers store every letter as a number, and every number as a pattern of ones and zeros. Type any text and the Text to Binary converter shows those patterns: the letter H, for example, is 01001000.

Besides binary, you can see the same bytes in hexadecimal, octal or decimal. The text is encoded as UTF-8 by default, the encoding used on the web, so accented letters, other alphabets and emoji work too. They simply take two, three or four bytes instead of one. For programming tasks, you can switch to UTF-16 code units, the way JavaScript, Java and Windows store strings.

Choose how the output is spaced: between bytes, between characters, not at all, or one byte per line. It is useful for learning how text encoding works, for puzzles and secret messages, and for checking what bytes a string really contains. Everything runs in your browser.

How to use it

  1. Type your textEnter any text in any language. Sample loads "Hi 👋", a short example with an emoji.
  2. Choose a number systemBinary, Hex, Octal or Decimal. The output updates immediately.
  3. Pick the spacingSpace between bytes, space between characters, no spaces, or one byte per line.
  4. Choose the encodingUTF-8 shows the bytes as they are stored in files and sent over the web. UTF-16 shows 16-bit code units, as used inside many programming languages.
  5. Copy the resultThe status line shows how many characters and bytes you converted. Copy the code or download it as a text file.

Key features

Four number systems

Binary with 8 digits per byte, hex with 2, octal with 3, and decimal.

Real UTF-8

Every character, including é, € and emoji, is converted to the exact bytes UTF-8 uses.

UTF-16 option

See the 16-bit code units of a string, including the two surrogate halves of an emoji.

Flexible spacing

Group the output by byte or by character, write it as one long string, or put each byte on its own line.

Leading zeros kept

Every byte is padded to full length, so 01000001 never becomes 1000001 and the code can be read back reliably.

Private by design

Nothing is uploaded. The conversion happens in your browser.

Examples

"Hi 👋" in every number system

The sample is 4 characters (H, i, a space and the emoji) and 7 bytes in UTF-8:

SystemResult
Binary01001000 01101001 00100000 11110000 10011111 10010001 10001011
Hex48 69 20 F0 9F 91 8B
Decimal72 105 32 240 159 145 139

H, i and the space are one byte each. The emoji 👋 takes four bytes, F0 9F 91 8B in hex.

Letters and their bytes

CharacterBinary (UTF-8)Hex
A0100000141
é11000011 10101001C3 A9
€11100010 10000010 10101100E2 82 AC
Line break000010100A

The first bits of a byte tell UTF-8 how long a character is: bytes starting with 0 stand alone, 110 starts a two-byte character, 1110 a three-byte one and 11110 a four-byte one.

Spacing options

For the word "Hi" in binary:

  • Space between bytes: 01001000 01101001
  • No spaces: 0100100001101001
  • One byte per line: 01001000 and 01101001 on separate lines

Space between characters matters for multi-byte characters: the emoji in the sample becomes one block, 11110000100111111001000110001011, instead of four.

UTF-8 versus UTF-16

With UTF-16, "Hi 👋" becomes 5 code units of 16 bits each. The emoji is stored as two of them, D83D and DC4B in hex, called a surrogate pair:

0000000001001000 0000000001101001 0000000000100000 1101100000111101 1101110001001011

Tips

  • Use hex when you compare bytes with a hex editor, a network capture or a programming tool. It is much shorter than binary and shows the same information.
  • To decode the result, paste it into Binary to Text with the same number system. Choose UTF-8 there for UTF-8 output, or Unicode code points for UTF-16 output with spaces between the units.
  • For puzzles and secret messages, choose Binary with No spaces. The message is harder to read at a glance, and Binary to Text can still split it into bytes.
  • If a character looks the same as another but behaves differently, convert both. An accented letter typed as one character and one made of a letter plus an accent mark give different bytes.
  • To get the Base64 form of the same bytes for an email or an API, use the Base64 Encoder.

Common mistakes and limits

  • Expecting one byte per characterOnly basic English letters, digits and punctuation take one byte in UTF-8. Accented letters take two, most other scripts and symbols three, and emoji four.
  • Confusing UTF-8 and UTF-16The two encodings give different numbers for the same text. UTF-16 output decoded as UTF-8 gives the wrong characters, so decode it as Unicode code points instead.
  • Dropping leading zerosWriting 01000001 as 1000001 breaks decoding when bytes are not separated. Keep all eight digits.
  • Decimal without spacesWith No spaces, decimal bytes are padded to three digits, as in 072105 for "Hi". Binary to Text cannot split decimal numbers that run together, so keep the spaces if you want to decode decimal output.
  • Converting only spacesText made only of spaces or line breaks shows no result. Add at least one other character to see the bytes.

Frequently asked questions

How is text converted to binary?
Each character is first turned into bytes with an encoding, here UTF-8 by default. Each byte is a number from 0 to 255, which is then written in base 2 as eight digits. H is byte 72, which is 01001000 in binary.
Why are some characters more than 8 bits?
UTF-8 uses one byte for the 128 basic ASCII characters and two to four bytes for everything else. é uses 16 bits, € uses 24 and 👋 uses 32.
What is the difference between UTF-8 and UTF-16?
UTF-8 uses 8-bit bytes and is the standard for files and the web. UTF-16 uses 16-bit code units and is how JavaScript, Java and Windows store strings internally. Most characters take one UTF-16 unit; emoji take two.
What does each number system show?
All four show the same bytes. Binary uses 0 and 1, hex uses 0 to 9 and A to F with two digits per byte, octal uses 0 to 7 with three digits, and decimal shows the plain value from 0 to 255.
Is this the same as ASCII to binary?
For basic English letters, digits and punctuation, yes. UTF-8 gives the same bytes as ASCII for those characters, and adds support for everything else.
Why does 👋 start with 11110?
In UTF-8, the first byte of a character says how many bytes follow. 11110 marks the start of a four-byte character, and each of the following bytes starts with 10.
How do I convert binary back to text?
Paste the code into the Binary to Text tool and choose the same number system. It accepts spaces, line breaks and commas between bytes, and binary, hex and octal also work without any separators.
Is my text sent anywhere?
No. The conversion runs in your browser, and nothing is uploaded.