ASCII to Binary Converter
Convert ASCII text to binary code and binary to text instantly. Supports hex, octal, decimal output with customizable delimiters and UTF-8 encoding.
About
Character encoding errors account for a significant share of data corruption in file transfers, serial communication, and legacy system integrations. This converter maps each character to its numeric code point and renders it in binary (base-2), hexadecimal (base-16), octal (base-8), or decimal (base-10) representation. Standard ASCII uses 7 bits per character, covering code points 0 - 127. Extended ASCII and UTF-8 use 8 bits or multi-byte sequences per RFC 3629. The tool performs bidirectional conversion: paste text to get binary, or paste binary to recover the original string.
Misidentifying encoding (e.g., treating UTF-8 multi-byte as ISO-8859-1) produces garbled output known as mojibake. This tool validates every input group against the selected encoding constraints before conversion. It approximates behavior for printable ASCII; control characters (code points < 32) are converted but may not render visibly. Pro tip: when debugging serial protocols, use the space delimiter and compare byte-by-byte against your device specification sheet.
Formulas
Each character is mapped to its Unicode code point, then converted to the target base. The fundamental conversion for a single character c to binary proceeds as follows:
Where charCodeAt(c) returns the decimal code point of character c, toString(n, 2) converts integer n to base-2 string, and pad left-pads with zeros to 8 bits. For the reverse direction:
For UTF-8 multi-byte characters (code points > 127), the encoder applies the RFC 3629 scheme:
Where cp is the Unicode code point and x bits are filled from the code point value. The conversion to hexadecimal uses base 16 with digits 0 - 9 and A - F, padded to 2 characters. Octal uses base 8, padded to 3 characters.
Reference Data
| Character | Decimal | Hex | Octal | Binary (8-bit) | Description |
|---|---|---|---|---|---|
| NUL | 0 | 00 | 000 | 00000000 | Null |
| SP | 32 | 20 | 040 | 00100000 | Space |
| ! | 33 | 21 | 041 | 00100001 | Exclamation mark |
| 0 | 48 | 30 | 060 | 00110000 | Digit zero |
| 9 | 57 | 39 | 071 | 00111001 | Digit nine |
| A | 65 | 41 | 101 | 01000001 | Uppercase A |
| Z | 90 | 5A | 132 | 01011010 | Uppercase Z |
| a | 97 | 61 | 141 | 01100001 | Lowercase a |
| z | 122 | 7A | 172 | 01111010 | Lowercase z |
| @ | 64 | 40 | 100 | 01000000 | At sign |
| # | 35 | 23 | 043 | 00100011 | Hash / Number sign |
| + | 43 | 2B | 053 | 00101011 | Plus sign |
| = | 61 | 3D | 075 | 00111101 | Equals sign |
| / | 47 | 2F | 057 | 00101111 | Forward slash |
| \ | 92 | 5C | 134 | 01011100 | Backslash |
| { | 123 | 7B | 173 | 01111011 | Left curly brace |
| } | 125 | 7D | 175 | 01111101 | Right curly brace |
| [ | 91 | 5B | 133 | 01011011 | Left square bracket |
| ] | 93 | 5D | 135 | 01011101 | Right square bracket |
| ~ | 126 | 7E | 176 | 01111110 | Tilde |
| DEL | 127 | 7F | 177 | 01111111 | Delete |
| LF | 10 | 0A | 012 | 00001010 | Line feed |
| CR | 13 | 0D | 015 | 00001101 | Carriage return |
| TAB | 9 | 09 | 011 | 00001001 | Horizontal tab |
| ESC | 27 | 1B | 033 | 00011011 | Escape |