Text to Binary Converter — Encode & Decode Binary Code
Enter any text to convert it to binary (0s and 1s), or paste binary code to decode it back to text. Each character is converted using its ASCII/Unicode value. Choose space-separated, newline-separated, or continuous binary output. The Swap button lets you immediately reverse the last conversion.
How it works
How text-to-binary conversion works
Every character in a computer is stored as a number. For standard ASCII text, the letter 'A' is number 65, 'B' is 66, lowercase 'a' is 97, a space is 32, and so on. To convert text to binary, this tool looks up the numeric value (ASCII/Unicode code point) of each character, then writes that number in base 2 (binary), padded to 8 digits. For example: 'H' = 72 decimal = 01001000 binary, 'e' = 101 decimal = 01100101 binary, 'l' = 108 decimal = 01101100 binary.
The reverse process (binary to text) reads 8-bit groups, converts each from base 2 back to a decimal number, then looks up the character with that code point. If you paste space-separated binary (like 01001000 01100101), the tool splits on spaces. If you paste continuous binary (like 0100100001100101), it automatically groups into 8-bit chunks. Each 8-bit group must contain exactly 8 ones and zeros — otherwise the tool shows an error identifying the invalid byte.
Binary vs hexadecimal for data representation
Binary (base 2) uses only 0 and 1, making it the most fundamental representation of digital data — it directly mirrors how bits are stored in computer memory. However, it is verbose: a single ASCII character needs 8 digits. Hexadecimal (base 16, using digits 0–9 and A–F) is more compact: each hex digit represents exactly 4 binary digits (a nibble), so one byte becomes just 2 hex digits. 'H' = 0x48 in hex vs 01001000 in binary.
Binary representation is most useful when you need to see or manipulate individual bits — for example, checking flags in a bitmask, understanding how Unicode code points encode into UTF-8 bytes, or analyzing network packet structures at the bit level. For most data-inspection tasks, hexadecimal offers a good balance between compactness and readability. Many debuggers, hex editors, and protocol analyzers show data in hex, with optional binary view for bit-level work.
Beyond ASCII: Unicode and multi-byte characters
Standard ASCII covers only 128 characters (7 bits, codes 0–127), sufficient for English text but not for accented characters, non-Latin scripts, or emoji. Modern text is encoded in Unicode, which defines over 140,000 characters. This tool uses JavaScript's built-in charCodeAt(), which returns the UTF-16 code unit for each character. For basic Latin characters this equals the Unicode code point, which also equals the ASCII code.
For non-ASCII characters such as 'é' (233), 'ñ' (241), '中' (20013), or '😀' (128512, which uses a UTF-16 surrogate pair), the binary representation will be longer or split differently. If you need binary encoding that matches how UTF-8 actually stores bytes on disk, you would need to UTF-8-encode the string first, then convert each resulting byte to binary. For most educational and encoding-puzzle purposes, the per-character approach used here is standard.
Frequently asked questions
›How do I convert text to binary?
Each character in the text is converted to its ASCII or Unicode numeric code, which is then written in binary (base 2) padded to 8 bits. For example: 'A' = 65 decimal = 01000001 binary. 'Hello' becomes 01001000 01100101 01101100 01101100 01101111. This tool handles the conversion automatically — just type your text in the left box with Text → Binary mode selected.
›How do I convert binary to text?
Select Binary → Text mode and paste your binary string. The binary must be in 8-bit groups (bytes). If separated by spaces, each space-delimited group is one byte. If continuous (no spaces), the tool groups every 8 digits as one byte. Each byte is converted from binary to a number, then looked up as an ASCII/Unicode character.
›Why is each binary group 8 digits long?
A byte is 8 bits, and ASCII uses 7-bit codes (0–127). By convention, ASCII codes are stored in a full 8-bit byte with a leading zero, making all entries exactly 8 binary digits. This makes parsing unambiguous: every 8 digits = one character. Some older representations use 7-bit ASCII (dropping the leading zero), but 8-bit encoding is the modern standard.
›What is the binary for common characters?
Space = 00100000, 'A' = 01000001, 'a' = 01100001, '0' = 00110000, Enter/newline (LF) = 00001010, period '.' = 00101110. The pattern is easy to spot: uppercase letters start with 010, lowercase letters start with 011, and digits start with 0011.
›Can this tool handle non-English characters?
Yes, for characters with Unicode code points below 65,536 (most Latin, Greek, Cyrillic, CJK, Arabic, Hebrew, etc.). Each character is converted to its Unicode code point in binary. However, because characters above 127 require more than 8 bits, they will produce binary groups longer than 8 digits. For emoji and other characters above U+FFFF, JavaScript splits them into surrogate pairs, which may produce unexpected results.
›What does the Swap button do?
Swap takes the current output (the binary string if encoding, or the text if decoding) and moves it to the input box, while switching the mode to the opposite direction. This lets you instantly verify a round-trip: encode some text, click Swap, and check that you get the original text back. It is also useful for exploring what binary strings encode to.
›Is binary the same as Morse code?
No. Binary uses exactly 8 bits (0s and 1s) to represent each character by its numeric ASCII/Unicode value. Morse code uses dots and dashes of variable length to represent letters and numbers, with sequences based on letter frequency in English (common letters like E and T have shorter codes). The two systems are completely different encoding schemes, though both represent text as a series of symbols.
›How is binary different from Base64?
Binary shows the actual bit pattern of each character — the raw bits stored in memory. Base64 is a higher-level encoding that converts arbitrary binary data (any file or byte sequence) into a safe ASCII text string using 64 printable characters. Base64 is used when you need to embed binary data in contexts that only accept text (like email attachments or data URIs). Binary representation is for human inspection of bit patterns; Base64 is for data transfer and storage.
Related tools
Last updated: