Home › How to Convert Text to Binary

How to Convert Text to Binary

Every character you type maps to a number, and every number translates to a string of ones and zeros. Here is exactly how that process works, step by step.

When you type the letter H, your computer does not store an H. It stores a number. That number then gets stored in physical memory as a pattern of electrical states: on or off, charged or uncharged, represented as 1 or 0. So text-to-binary conversion is really two translations in sequence: character to decimal number, then decimal number to base-2 binary. Understanding both steps tells you a lot about how computing actually works at the level below software.

The good news is that neither step requires anything beyond basic arithmetic. You do not need a programming background. What you do need is a clear picture of ASCII, the encoding standard that assigns a number to each printable character.

What is ASCII?

ASCII stands for American Standard Code for Information Interchange. Published in 1963 and finalized in 1968, it assigns a unique integer from 0 to 127 to every character a typewriter keyboard could produce at the time: the 26 uppercase letters, the 26 lowercase letters, the digits 0 through 9, punctuation marks, and a handful of control codes like newline and tab.

The system was designed so that common letters would cluster near the middle of the range, making sorting and comparison predictable. Uppercase letters run from 65 (A) to 90 (Z). Lowercase letters run from 97 (a) to 122 (z). The digit characters 0 through 9 start at 48. That ordering was not arbitrary; it lets software compare strings alphabetically with a single integer subtraction.

ASCII covers only 128 code points, which handles English text fine but nothing beyond it. For accented characters, non-Latin scripts, and emoji, computers use Unicode (usually in its UTF-8 encoding). For this article, we are sticking with standard ASCII, which is the right starting point. For a deeper look at how the standard developed and what came after it, see our full ASCII guide.

The step-by-step process

Converting any text string to binary takes three steps per character. Repeat those steps for each character in order, then join the results with spaces between each 8-bit group.

Step 1: Find the ASCII code for the character. You can look this up in a table or remember that A is 65, a is 97, 0 is 48, and space is 32. Everything else falls relative to those anchors.

Step 2: Convert that decimal number to binary. Take the number and repeatedly divide it by 2, recording the remainder each time. Read the remainders from bottom to top. That sequence is the binary representation.

For example, take 72 (the ASCII code for uppercase H):

  • 72 / 2 = 36 remainder 0
  • 36 / 2 = 18 remainder 0
  • 18 / 2 = 9 remainder 0
  • 9 / 2 = 4 remainder 1
  • 4 / 2 = 2 remainder 0
  • 2 / 2 = 1 remainder 0
  • 1 / 2 = 0 remainder 1

Reading those remainders from bottom to top: 1001000.

Step 3: Pad to 8 bits. The result above is only 7 digits. Standard text encoding stores each character in exactly one byte, which is 8 bits. Add a leading zero to make it 8 digits: 01001000. That is the binary for H.

Worked example: converting "Hi"

Take the two-character string "Hi". Work through each character separately.

H: ASCII code 72. Divide-by-2 method gives 1001000. Padded to 8 bits: 01001000.

i: ASCII code 105. The divide-by-2 sequence:

  • 105 / 2 = 52 remainder 1
  • 52 / 2 = 26 remainder 0
  • 26 / 2 = 13 remainder 0
  • 13 / 2 = 6 remainder 1
  • 6 / 2 = 3 remainder 0
  • 3 / 2 = 1 remainder 1
  • 1 / 2 = 0 remainder 1

Reading from bottom to top: 1101001. Padded to 8 bits: 01101001.

Final result for "Hi": 01001000 01101001

Two characters, two bytes, sixteen binary digits total. That is the complete binary encoding of the word "Hi."

Common characters and their binary codes

This table covers the characters you are most likely to need. Memorizing the anchor values (A = 65, a = 97, space = 32, 0 = 48) lets you calculate any other standard ASCII character from scratch.

CharacterASCII (decimal)Binary (8-bit)
A6501000001
B6601000010
Z9001011010
a9701100001
space3200100000
04800110000
14900110001
!3300100001
?6300111111

Notice that the digit character "1" (ASCII 49, binary 00110001) is completely different from the number 1 in binary (just 1 or 00000001 padded to 8 bits). The character and the number share a name but not a value. That distinction trips people up more than any other part of the conversion.

The fast way: use the tool

Working through the divide-by-2 process by hand is worth doing once, maybe twice, so the mechanism sticks. After that, the binary translator on the home page handles it instantly. Paste or type any text, and the tool outputs the full binary string with each byte separated by a space. It also works in reverse if you want to decode binary back to text.

The tool runs entirely in your browser. Nothing you type is sent to a server or stored anywhere. That matters if you are converting anything even slightly sensitive, like a password or a private message you are trying to debug.

Common mistakes to avoid

A few errors show up repeatedly in manual conversions.

Forgetting to pad to 8 bits. If your binary result is only 6 or 7 digits, do not leave it short. Add leading zeros until you have 8. Skipping this step means whoever tries to decode your output will get different character boundaries than you intended.

Getting an odd total bit count. Each character should contribute exactly 8 bits. If your full binary string has a length that is not a multiple of 8, something went wrong: you likely dropped a digit during a division step or skipped the padding on one character. Count the total bits and divide by 8. The quotient should exactly equal the number of characters in the original text.

Mixing character encoding systems. ASCII covers standard English keyboard characters. If your source text includes an accented character like e-acute or a currency symbol like the euro sign, those are not in the 7-bit ASCII table. They need Unicode. The tool on this site handles UTF-8 encoding for those characters automatically, but if you are converting by hand, be aware you are no longer in single-byte territory.

Confusing digit characters with numeric values. The character "9" is ASCII 57, which in binary is 00111001. The number 9 in binary is 00001001. They are not the same. When someone asks you to "convert the number 9 to binary," they almost certainly mean the numeric value, not the text character.

FAQ

Why is binary always 8 bits per character?

Standard ASCII encodes 128 characters using values 0 to 127, which requires at most 7 bits. The 8-bit byte became the standard storage unit in computing, so text is stored one byte per character. The leading zero in an 8-bit representation is padding to fill that byte, not wasted space.

What is the binary code for a space character?

A space has ASCII value 32. In 8-bit binary that is 00100000. It is easy to overlook spaces when copying binary output, but they are full characters with their own code.

Does uppercase A have the same binary value as lowercase a?

No. Uppercase A is ASCII 65 (01000001) and lowercase a is ASCII 97 (01100001). They differ by exactly 32, which is the ASCII value of a space. That pattern holds for all 26 letters.

Can I convert emoji or accented characters to binary with ASCII?

Not with standard 7-bit ASCII. Accented letters and emoji use Unicode, most commonly encoded as UTF-8. UTF-8 represents those characters as two, three, or four bytes rather than one, so each character becomes 16, 24, or 32 bits of binary rather than 8.

Cookies here just cover analytics and ad delivery, nothing more. Privacy