Skip to main content
AtoolinBlog
All Posts

What Is Text to Binary? How Computers Store Text as 0s and 1s

By Hans5 min read

Every character you type (letters, numbers, punctuation) gets stored in memory as a sequence of 0s and 1s. Computers don't understand human language directly; they work with binary numbers. A text-to-binary encoding standard maps each character to a specific number, and that number gets written in binary. Text to binary conversion is just that mapping made visible.

Why Computers Use Binary

Computers are built from transistors, tiny electronic switches that are either on or off. "On" is 1, "off" is 0. Everything a computer stores or processes lives as sequences of these two states.

Binary isn't arbitrary. Electronic components reliably distinguish two voltage states: clearly high or clearly low. Trying to distinguish ten voltage levels inside a chip that small would introduce errors constantly. Two states is the practical floor.

How Text Gets Encoded as Binary Numbers

To store text, computers need a lookup table that assigns a number to each character. The most important such standard is ASCII (American Standard Code for Information Interchange), published in 1963.

ASCII assigns a number from 0 to 127 to each character. The capital letter "A" is 65. Lowercase "a" is 97. The digit "5" is 53. A space is 32.

Converting a character to binary means converting its ASCII number to base 2. The number 65 in binary is 01000001 — eight digits, called bits. One byte (8 bits) covers values from 0 to 255, which is more than the 128 ASCII characters need.

ASCII to binary reference

Character ASCII decimal Binary
A 65 01000001
B 66 01000010
a 97 01100001
z 122 01111010
0 48 00110000
9 57 00111001
Space 32 00100000
! 33 00100001

The word "Hi" in binary: 01001000 01101001 — eight bits for "H" (72), eight bits for "i" (105).

ASCII vs. UTF-8

ASCII covers 128 characters, which works fine for English but leaves out most of the world's writing systems. UTF-8 was introduced in 1993 to fix that.

UTF-8 is backward compatible with ASCII: any character with a code point below 128 uses the same single byte. Characters outside that range use 2, 3, or 4 bytes. The Chinese character "中" has a Unicode code point of U+4E2D and encodes to three bytes in UTF-8: 11100100 10111000 10101101.

UTF-8 now handles over 140,000 characters across 159 scripts. It accounts for roughly 98% of web pages as of 2024, per the W3C Web Almanac. When you type in any modern application, UTF-8 is almost certainly the encoding in use.

How Text to Binary Conversion Works

The process follows a fixed sequence:

  1. Take each character in your text.
  2. Find its Unicode code point (for ASCII characters, this matches the ASCII number).
  3. Encode that code point as bytes using UTF-8.
  4. Convert each byte to its 8-bit binary representation.

For "Cat":

  • C → 67 → 01000011
  • a → 97 → 01100001
  • t → 116 → 01110100

Result: 01000011 01100001 01110100

To convert any text to binary instantly, use a free text-to-binary tool — paste your text and get the binary output in one click, no manual lookup required.

Binary Back to Text

Decoding reverses the steps. Take each group of 8 bits, convert the binary to decimal, then look up the character for that value.

01000001 → 65 → "A"

Encoding and decoding must use the same standard. Encode text as UTF-8, try to decode it as Latin-1, and any character outside the ASCII range comes out garbled. That scrambled-text problem — called mojibake — was common in older email clients and databases that didn't track encoding alongside the stored bytes.

Where Text to Binary Conversion Comes Up

Programming courses use it to teach data types and bitwise operations. Network protocol debugging with tools like Wireshark goes down to the byte level, where knowing what bits map to which characters matters. CTF (Capture the Flag) security competitions regularly encode messages in binary. Steganography hides text inside images by writing bits into the least-significant positions of pixel values. Cryptographic hash functions also operate on the binary representation of input text, so consistent encoding is required for consistent hash output.

FAQ

What is the binary code for the letter A?

The letter "A" (uppercase) has an ASCII value of 65, which is 01000001 in 8-bit binary. Lowercase "a" is 97 in decimal — 01100001 in binary. ASCII gives uppercase and lowercase separate code points, so the binary representations differ.

Is binary the same as ASCII?

No. Binary is a number system using only 0 and 1. ASCII is an encoding standard that maps characters to numbers. Text to binary conversion uses ASCII (or UTF-8) to get the number for each character, then converts that number to binary. Binary is the format; ASCII or UTF-8 is the mapping.

How many bits does one character take in binary?

Standard English letters, digits, and basic punctuation each take 8 bits (1 byte) in ASCII and UTF-8. UTF-8 uses 2 bytes for accented Latin characters and many currency symbols, 3 bytes for most Asian scripts, and 4 bytes for emoji and some rarer scripts.