HomeMath › Text to Binary Converter

Text to Binary Converter

Encode text into binary. Type any words or symbols to get the 8-bit ASCII binary for each character, separated by spaces, along with the total bit count and the decimal code of every character.

Example: with Text Hi → Binary: 01001000 01101001.

  • Size16 bits (2 characters)
  • Decimal codes72 105

Computed by the calculator below using its default values. Change any input to see your own numbers.

Binary
Size
Decimal codes

Each character becomes its ASCII code, written as an 8-bit byte with leading zeros. H is code 72, which is 01001000. Bytes are shown space-separated so they stay readable.

Every character is a byte

Text becomes binary in two steps. First each character maps to its ASCII code, a number from 0 to 127 for standard English text. Then that number is written in base 2 and padded with leading zeros to a full 8-bit byte, so the capital H at code 72 becomes 01001000. Stringing the bytes together, with spaces for readability, gives the binary form of the whole message.

The padding matters. Fixed 8-bit bytes are what let a decoder split the stream back into characters unambiguously, since it always knows a new character starts every 8 bits. Drop the leading zeros and the boundaries blur, which is the most common reason a hand-written conversion fails to decode.

How it’s calculated

For each character, take its code point (charCodeAt), convert to base 2, and left-pad with zeros to at least 8 bits. Bytes are joined with spaces. The size line sums the actual bit lengths, and the decimal line lists each code point.

Standard characters use one 8-bit byte. Characters above code 255 (many emoji and non-Latin scripts) need more than 8 bits and are shown with their full binary length rather than split into UTF-8 bytes.

Characters as 8-bit binary

CharacterDecimalBinary (8-bit)
A6501000001
H7201001000
i10501101001
04800110000
(space)3200100000

ASCII code points converted to 8-bit binary.

Common mistakes

  • Leaving off leading zeros, so bytes are not a uniform 8 bits.
  • Forgetting that uppercase and lowercase letters have different codes (H is 72, h is 104).
  • Running bytes together with no separator, which is valid but hard to read.
  • Assuming one byte per character for emoji or accented letters, which actually need more.

Frequently asked questions

How do you convert text to binary?

Turn each character into its ASCII code, then write that code in base 2 as an 8-bit byte with leading zeros. H is 72, which is 01001000.

Why is each byte 8 bits?

Fixed 8-bit bytes let a reader break the stream back into characters cleanly, because a new character begins every 8 bits. It also covers all 256 basic code values.

What are the decimal codes?

They are the ASCII code points behind each character, the numbers that get written in binary. They make it easy to cross-check the conversion.

Does this handle emoji and accented letters?

It converts their raw code point to binary, but those characters really use multiple UTF-8 bytes, so the 8-bit-per-character assumption does not hold for them.