String Functions
String to Binary Converter
Convert any string to its binary representation, byte by byte (space-separated).
About converting strings to binary
This tool converts any string into its binary representation, one byte at a time. Paste text in and it returns a space-separated list of binary groups, one group per byte of the UTF-8-encoded input, in the order the bytes appear. It strips carriage returns and line feeds before converting, so multi-line input is joined into one continuous stream rather than converted line by line. The whole operation runs in your browser — nothing you type is sent to a server, logged, or stored.
Under the hood, the input first goes through the TextEncoder API, which encodes the JavaScript string to raw UTF-8 bytes — the same encoding used on the wire for HTML, JSON, and most web text. Each byte is then converted individually with (byte).toString(2), JavaScript's built-in base-2 conversion. That method drops leading zeros, so a byte like 65 (A) renders as 1000001, seven digits, rather than the zero-padded eight-digit 01000001 a fixed-width ASCII table would show. The output keeps that unpadded form.
Byte-level binary is useful beyond curiosity: it helps you verify a custom encoder, debug a binary protocol, or check exactly how many bytes a piece of text takes up. It also shows UTF-8 in action — paste an accented letter or emoji and it expands into two or more binary groups instead of one, which is what "multi-byte character" means in practice. Most languages need a short loop for the same result; PHP, for instance, has no single built-in for it and typically combines unpack('C*', $str) with decbin() per byte.
Examples
Input: Hi!
Output: 1001000 1101001 100001
H (byte 72) → 1001000
i (byte 105) → 1101001
! (byte 33) → 100001Each byte converts independently via toString(2) with no zero-padding — ! (byte value 33) becomes 100001 (6 digits), not the 8-digit 00100001 a fixed-width table would show.
Input: café
Output: 1100011 1100001 1100110 11000011 10101001
c → 1100011
a → 1100001
f → 1100110
é → 11000011 10101001 (2 UTF-8 bytes: 0xC3 0xA9)The converter encodes to UTF-8 bytes before converting, so café's 4 visible characters produce 5 binary groups — é alone is 2 bytes in UTF-8 (0xC3 0xA9).
const bytes = new TextEncoder().encode('Hi!');
[...bytes].map(b => b.toString(2)).join(' ');
// → "1001000 1101001 100001"
// charCodeAt() is NOT equivalent for non-ASCII input —
// it reads UTF-16 code units, not UTF-8 bytes:
'café'.charCodeAt(3).toString(2); // "11101001" (not the 2 UTF-8 bytes the tool produces)TextEncoder is the same Web API this tool uses internally. charCodeAt() looks like a shortcut but reads UTF-16 code units, so it silently diverges from UTF-8 bytes for anything outside ASCII.
Frequently asked questions
Why don't the binary groups have 8 digits each?
Each byte is converted with JavaScript's (byte).toString(2), which drops leading zeros. A byte value of 33 (!) becomes 100001, not the zero-padded 00100001 an 8-bit ASCII table would show. Pad each group yourself with .padStart(8, '0') if you need fixed-width output.
Why did my line breaks disappear from the output?
The tool strips \r and \n from the input before converting, so multi-line text collapses into one continuous byte stream. Text on separate lines runs together directly, with no space inserted where the line break used to be.
Why does one accented letter or emoji turn into two or more binary groups?
The tool encodes the input to UTF-8 bytes first (via TextEncoder), then converts each byte, not each visible character. ASCII characters are 1 byte, but accented letters, symbols, and emoji take 2 to 4 bytes in UTF-8, so a single character can expand into multiple binary groups.
Is this the same as a standard ASCII-to-binary table?
For plain ASCII text, yes — each byte is 0 to 127 and matches a standard table once you zero-pad it to 8 digits. Outside ASCII, the tool follows UTF-8 byte encoding rather than a fixed one-character-to-one-byte mapping.
Does this tool send my text to a server?
No. The conversion runs entirely in your browser using the TextEncoder API — nothing you type is uploaded, logged, or stored.