All Tools
T

Binary Code Translator

Convert text to binary code or decode binary back to text

Read the full guide for this tool

Binary Code Translator: Text to Ones and Zeros

Every character your computer displays is stored as a number. Every number is stored as binary — ones and zeros. The letter A is 01000001. The word Hello is 01001000 01100101 01101100 01101100 01101111.

That's it. That's what your CPU actually sees.

This tool converts text to binary and binary back to text. Each character becomes an 8-bit byte, space-separated so you can actually read it. Runs entirely in your browser — nothing leaves your machine.


What's actually happening

Encoding works like this: take a character, get its numeric value from the character encoding, convert that number to binary, pad it to 8 bits.

The letter A has a character code of 65. In binary, 65 is 1000001. Pad to 8 bits: 01000001.

The tool uses JavaScript's charCodeAt() under the hood, which returns the UTF-16 code unit. For standard ASCII characters (code points 0–127), you get a clean 8-bit representation. Characters are space-separated in the output so you can tell where one byte ends and the next begins.

Decoding is the reverse: split the input on spaces, parse each 8-bit chunk as a binary number, convert back to a character with String.fromCharCode(). It expects exactly 8 bits per group. Anything shorter, longer, or containing characters other than 0 and 1 will fail.


How to use it

Pick Encode or Decode. Paste your input. Output updates instantly. Hit Copy to grab it. The toggle button swaps input and output and flips the direction if you want to go the other way.


When you'd actually reach for this


ASCII, UTF-8, and why 8 bits isn't always the full story

Standard ASCII uses 7 bits — values 0 to 127 — covering English letters, digits, and basic punctuation. The 8th bit was unused. Then various "extended ASCII" encodings claimed it for additional characters, all differently, and that caused chaos for years.

UTF-8 solved it with variable-length encoding. ASCII characters stay as one byte. Characters from other scripts use 2 to 4 bytes. The euro sign , for example, is 3 bytes in UTF-8: 11100010 10000010 10101100.

This tool uses charCodeAt(), which operates on UTF-16 code units. For plain ASCII, you get a clean 8-bit output. For characters beyond ASCII, you'll get the UTF-16 code unit as binary — which might not be what you expect if you're thinking in UTF-8 terms.

Worth knowing before you paste in anything non-English and wonder why the output looks weird.


Why binary is worth understanding

It's not just academic. Knowing binary makes you better at several things that come up in real dev work:

Bitwise operations. Shifting, masking, AND/OR/XOR. Unix file permissions are a bitmask. Feature flags often are too. Network protocols and performance-sensitive code use them constantly. Once you see the bits, the logic clicks.

Debugging. When a byte is 0xFF instead of 0x0F, seeing it in binary — 11111111 vs 00001111 — makes the problem obvious immediately. Hex is compact but binary makes the structure visible.

Reading specs. PNG headers, TCP flags, DNS packets — they're all described in terms of bits and bytes. Keeping a binary view open while reading a protocol spec makes the layout make sense instead of feeling abstract.


Edge cases

Non-printable characters. Binary values below 32 are control characters: tab, newline, null, and others. If you decode something and get garbage or invisible output, the values probably don't correspond to printable ASCII. Values above 127 depend on encoding.

Emoji and multi-byte characters. A single emoji might be represented by 2 or more 16-bit code units (surrogate pairs in UTF-16). The tool processes one charCodeAt() value at a time, so emoji will produce multiple byte groups that don't individually decode to anything meaningful. This is a known limitation of the simple single-byte approach.

Numeric types. Everything in binary here is a string representation. If you need the actual integer value downstream, you'll need to parse it — parseInt('01000001', 2) gives you 65.


Troubleshooting

Decoded output has weird or missing characters — the binary values probably don't map to printable ASCII. Values below 32 are control characters. Check what you're actually trying to decode.

Decoding fails entirely — the tool expects space-separated groups of exactly 8 binary digits. Common causes: groups that aren't 8 bits long, characters other than 0 and 1 in the input, missing spaces between groups, or leading/trailing whitespace messing up the split.

My binary has no spaces and won't decode — the tool needs spaces to know where one byte ends and the next begins. 0100100001101001 is ambiguous. Split it manually into 8-bit chunks: 01001000 01101001.

Emoji output looks broken — see above. Multi-byte characters produce multiple groups. It's not a bug, it's how UTF-16 works. If you need proper UTF-8 byte representation for emoji, you'd need a different approach.

Output doesn't match what I see in a hex editor — hex editors show bytes in hexadecimal, not binary. Each hex digit is 4 bits. 0x48 is 01001000. To convert: split each 8-bit group into two 4-bit nibbles and map to hex digits. Or just use a hex converter tool alongside this one.


What to do with the output

For learning: encode a few words and look at the patterns. Uppercase letters start with 010. Lowercase with 011. Digits 0–9 start with 0011. These aren't random — they're the structure of ASCII, and seeing them in binary makes it stick.

For CTFs: binary is usually one layer in a multi-step encoding chain. Decode the binary to text, then check if the result is another encoding — Base64, hex, Morse. Peel the layers one at a time.

For teaching: this is the best way to make character encoding tangible. Show someone that A is 01000001 and a is 01100001 — they differ by exactly one bit (bit 5). That's not a coincidence. That's a design decision from 1963 that's still in your computer right now.


Limitations

Further reading: ASCII table, UTF-8, binary encoding.