The problem: text is not binary, but computers only read binary
Computers do not understand characters. They understand voltages — on or off, 1 or 0. Every character you type, every emoji you send, every accented letter in a French email is stored as a sequence of 1s and 0s. The mapping between "human-readable character" and "binary number" is called a character encoding, and the choice of encoding determines what binary you get.
The letter A is 65 in decimal. In binary, 65 is 01000001 — eight bits, one byte. That is ASCII: the American Standard Code for Information Interchange, a 1963 standard that maps 128 characters to numbers 0 through 127. It covers English uppercase (65-90), lowercase (97-122), digits (48-57), punctuation, and 33 control codes (0-31 and 127). It does not cover accented letters, Chinese characters, Arabic script, or emoji. If your text is English-only, ASCII is sufficient. If it is anything else, you need UTF-8.
The Text to Binary Converter handles all three: ASCII (truncates to one byte per character), UTF-8 (variable 1-4 bytes, full Unicode), and UTF-16 (2 bytes per character for most, 4 for surrogate pairs). It outputs binary, hex, octal, and decimal simultaneously, decodes in any direction, and includes a binary arithmetic calculator for bitwise operations.
Fastest path
Open the Text to Binary Converter, type or paste your text into the input area. The tool shows four output cards — binary, hexadecimal, octal, and decimal — updating in real time. Pick your encoding (ASCII, UTF-8, or UTF-16) from the dropdown. Choose a separator (space, none, newline, comma, pipe) for the output. Toggle bit grouping (4-bit nibbles, 8-bit bytes, 16-bit words) if you want visual grouping. Use the swap button to flip direction — it carries the current output into the input and switches to decode mode.
How a character becomes binary
The process is three steps: character to code point, code point to bytes, bytes to binary.
Step 1 — Character to code point. Each character has a number assigned by a standard. In ASCII, A is 65, B is 66, a is 97, 0 is 48, space is 32, the newline character is 10. These numbers are arbitrary — the ASCII committee assigned them in 1963 and they have not changed. The Unicode standard extends this to 154,994 characters across 161 scripts, but the first 128 Unicode code points are identical to ASCII. U+0041 is A. U+0042 is B. U+0061 is a. The Unicode code point is the universal identifier; the encoding determines how it becomes bytes.
Step 2 — Code point to bytes. This is where encodings diverge. ASCII maps each code point 0-127 to a single byte (the byte value equals the code point). UTF-8 is variable-length:
| Code point range | Bytes | Binary pattern |
|---|---|---|
| 0 - 127 | 1 | 0xxxxxxx |
| 128 - 2047 | 2 | 110xxxxx 10xxxxxx |
| 2048 - 65535 | 3 | 1110xxxx 10xxxxxx 10xxxxxx |
| 65536 - 1114111 | 4 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
The x bits are filled with the code point's binary representation, high bits first. A (U+0041, decimal 65) fits in one byte: 01000001. The Euro sign (U+20AC, decimal 8364) needs three bytes: 11100010 10000010 10101100. The party popper emoji (U+1F389, decimal 127881) needs four bytes: 11110000 10011111 10001110 10001001.
UTF-16 uses a different strategy: 2 bytes for most characters (code points 0-65535 stored directly), 4 bytes for characters above 65535 (using surrogate pairs — two 2-byte values that together encode one character). A is 01000001 00000000 in UTF-16 (the byte order depends on endianness). UTF-16 wastes a byte for ASCII text (every ASCII character gets a leading 00000000 byte) but is efficient for scripts whose characters are mostly in the 128-65535 range (Chinese, Japanese, Korean, Arabic, Hebrew).
Step 3 — Bytes to binary. Each byte is 8 bits. The binary representation uses positional notation — each bit position represents a power of 2:
Position: 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
Value: 128 64 32 16 8 4 2 1
For A (decimal 65): 64 + 1 = 65, so bit 6 and bit 0 are set: 01000001. The divide-by-2 algorithm converts any number to binary by repeatedly dividing by 2 and recording the remainder:
65 / 2 = 32 remainder 1 ← bit 0
32 / 2 = 16 remainder 0 ← bit 1
16 / 2 = 8 remainder 0 ← bit 2
8 / 2 = 4 remainder 0 ← bit 3
4 / 2 = 2 remainder 0 ← bit 4
2 / 2 = 1 remainder 0 ← bit 5
1 / 2 = 0 remainder 1 ← bit 6
0 / 2 = 0 remainder 0 ← bit 7
Reading remainders bottom-to-top: 01000001. The tool's step-by-step mode shows this algorithm for each character in your input.
Why four bases, not just binary
The tool outputs binary, hex, octal, and decimal simultaneously. Binary is what the computer stores, but humans do not read 8-bit binary strings efficiently — 01000001 takes longer to parse than 41 (hex) or 65 (decimal). Each base has a practical context:
Hexadecimal (base 16) maps cleanly to binary: each hex digit is exactly 4 bits. 0x41 is 0100 0001. Hex is the standard representation for byte values in programming, network protocols, and debuggers. A hex dump of a file shows each byte as two hex digits — compact and unambiguous.
Octal (base 8) maps to binary in groups of 3 bits. Each octal digit is 3 bits, so one byte (8 bits) needs 3 octal digits with the leading digit limited to 0-3. Octal is less common than hex but appears in Unix file permissions (chmod 755), C-style escape sequences (\101 for A in octal), and some legacy systems.
Decimal (base 10) is what humans use. The ASCII table is indexed in decimal. When you look up "what is the ASCII code for A," the answer is 65 — not 0x41 or 01000001. The decimal card is the cross-reference between the binary output and the ASCII table.
The tool shows all four so you do not have to convert between bases manually. The binary card is the actual encoding; the others are reference representations of the same bytes.
UTF-8 vs UTF-16: which to pick
The tool's default is UTF-8, and for most text, UTF-8 is the right choice. It is the dominant encoding on the web — over 98 percent of websites use it. It is backward-compatible with ASCII (a pure ASCII text is valid UTF-8 with identical bytes). It is variable-length, so English text takes one byte per character, European text takes 1-2 bytes, and CJK text takes 3 bytes per character.
UTF-16 is better when your text is predominantly CJK characters above U+0800 but below U+FFFF — those take 3 bytes in UTF-8 but 2 bytes in UTF-16. For English text, UTF-16 doubles the file size (every character gets a leading zero byte). For text with emoji (above U+FFFF), both encodings use 4 bytes, so there is no advantage.
The tool's statistics panel shows the encoding overhead — how many extra bytes the encoding uses compared to the minimum. For English text in UTF-8, the overhead is zero. For the same text in UTF-16, the overhead is 100 percent (every byte is doubled). For Chinese text in UTF-8, each character is 3 bytes; in UTF-16, each is 2 bytes — UTF-16 is more efficient. The statistics card makes this comparison visible.
Binary arithmetic: bitwise operations
The tool includes a binary arithmetic calculator that performs operations on two binary numbers:
AND — each output bit is 1 only if both input bits are 1. 1100 AND 1010 = 1000. Used for masking — extracting specific bits from a value.
OR — each output bit is 1 if either input bit is 1. 1100 OR 1010 = 1110. Used for combining flags — setting specific bits without affecting others.
XOR — each output bit is 1 if the input bits differ. 1100 XOR 1010 = 0110. Used for toggling bits and simple encryption (XOR with a key, XOR again with the same key to decrypt).
NOT — inverts every bit. NOT 01000001 = 10111110. In an 8-bit system, NOT of 65 gives 190 (unsigned) or -66 (signed two's complement).
Shift left — moves all bits left by N positions, filling with zeros. 00000001 << 3 = 00001000. Left shift by N is equivalent to multiplying by 2^N.
Shift right — moves all bits right by N positions. 00001000 >> 3 = 00000001. Right shift by N is equivalent to integer division by 2^N (for unsigned values).
The calculator shows the result in binary, decimal, hex, and octal — the same four bases as the converter.
Decoding: auto-detection and reconstruction
Decoding binary back to text requires two pieces of information: the encoding (ASCII, UTF-8, or UTF-16) and the input format (binary, hex, octal, or decimal). The tool's auto-detect feature inspects the input and identifies the format:
- Binary: only 0s and 1s (with optional spaces/commas/separators)
- Hex: digits 0-9 and letters a-f/A-F, typically in 2-digit groups
- Octal: digits 0-7, typically in 3-digit groups
- Decimal: digits 0-9, values up to 255 for single-byte encodings
After decoding, the tool re-encodes the result in all four formats and displays them — a cross-reference check that confirms the round-trip is lossless. If the decoded text does not re-encode to the same bytes you started with, something went wrong (typically an encoding mismatch — you decoded UTF-8 bytes as ASCII, or vice versa).
Gotchas
- ASCII mode truncates characters above 127. If you type the Euro sign, a Chinese character, or an emoji with ASCII encoding selected, the tool masks each character code to
0xff— effectively taking the low byte. For characters above 255, this loses data silently. The decoded result will not match the original. Use UTF-8 for any text that is not pure ASCII. - UTF-16 byte order matters. UTF-16 can be big-endian (high byte first) or little-endian (low byte first). The tool uses big-endian (the standard network byte order). If you are decoding UTF-16 bytes from a Windows file, they are probably little-endian — the bytes need swapping. A byte order mark (BOM) —
FE FFfor big-endian,FF FEfor little-endian — at the start of the file indicates the order. The tool does not detect or handle BOMs. - Decode auto-detect can be fooled. A string of 1s and 0s with spaces is clearly binary. But
101could be binary (decimal 5), octal (decimal 65, the letter A), or decimal (the number one hundred one). The auto-detect uses heuristics — it picks the format that produces valid text. If all formats produce garbage, it defaults to binary. When the auto-detect result looks wrong, manually select the format. - Binary output size scales with text length and encoding. A 1,000-character English text is 8,000 bits in UTF-8 (1 byte per character, 8 bits per byte). The same text in UTF-16 is 16,000 bits. A 1,000-character Chinese text is 24,000 bits in UTF-8 (3 bytes per character) but 16,000 bits in UTF-16 (2 bytes per character). The tool handles any length, but copying very long binary strings is impractical — use the download button for large outputs.
- The binary arithmetic calculator operates on unsigned integers. NOT of 65 gives 190, not -66. Shift right does not preserve the sign bit. If you need signed arithmetic (two's complement), convert the result manually — the tool's decimal output treats values as unsigned 8-bit or 32-bit depending on the input length.
Summary
- Text to binary is character encoding: each character maps to a number (code point), each number maps to bytes (encoding), each byte maps to 8 bits (binary). ASCII covers 128 characters in 1 byte each. UTF-8 is variable-length: 1 byte for 0-127 (identical to ASCII), 2 bytes for 128-2047, 3 bytes for 2048-65535, 4 bytes above that. UTF-16 uses 2 bytes for most characters, 4 for surrogate pairs.
- The byte-to-binary conversion uses positional notation — 8 bits, positions 2^7 through 2^0, values 128/64/32/16/8/4/2/1. The divide-by-2 algorithm produces binary by recording remainders. Hex (base 16, 4 bits per digit) and octal (base 8, 3 bits per digit) are compact representations of the same bytes. The tool shows all four bases simultaneously.
- UTF-8 is the right default — it is the web standard, backward-compatible with ASCII, and efficient for most text. UTF-16 is better for text predominantly in the CJK range (U+0800 to U+FFFF). The tool's statistics panel shows encoding overhead so you can compare. ASCII mode truncates characters above 127 — use it only for pure English text.
- Binary arithmetic (AND, OR, XOR, NOT, shift) operates on individual bits. AND masks, OR combines, XOR toggles, NOT inverts, shifts multiply or divide by powers of 2. The calculator shows results in all four bases.
- Use the Text to Binary Converter for encoding and decoding across ASCII/UTF-8/UTF-16, the Morse Code Translator for another character-to-signal encoding, the Hex to Decimal Converter for base conversion, and the Word Counter for text statistics.