ASCII to Any Base Converter
Convert ASCII text to binary, octal, decimal, hexadecimal, or any base from 2 to 36. Supports padding, prefixes, and custom separators.
About
Every character in a text string maps to a numeric code point defined by the ASCII standard (American Standard Code for Information Interchange, ANSI X3.4-1986). That code point is a base-10 integer, but hardware, protocols, and file formats frequently require the value expressed in base-2, base-8, or base-16. Getting the radix wrong in a network packet header or a memory dump causes silent data corruption. This tool converts each character's code point into any radix from 2 to 36, applying consistent zero-padding so every token occupies the same width. It handles the full byte range 0 - 255 (extended ASCII / Latin-1). Note: characters above code point 127 fall outside strict 7-bit ASCII and follow ISO 8859-1 mapping.
Formulas
The conversion from a text character to its representation in base b follows two steps. First, extract the character's code point. Then, express that integer in the target radix by repeated division.
The code point c is then converted to base b using the standard positional decomposition:
where each digit di is the remainder of successive division:
Digits are collected least-significant first, then reversed. For remainders โฅ 10, the standard convention maps 10 โ A, 11 โ B, โฆ 35 โ Z.
Padding width w for a full byte is: w = โ8log2(b)โ. For base 2: w = 8. For base 8: w = 3. For base 16: w = 2.
Where c = code point (integer), b = target base/radix (2 - 36), di = digit at position i, w = zero-pad width.
Reference Data
| Char | Dec | Hex | Oct | Binary | Description |
|---|---|---|---|---|---|
| NUL | 0 | 00 | 000 | 00000000 | Null |
| TAB | 9 | 09 | 011 | 00001001 | Horizontal Tab |
| LF | 10 | 0A | 012 | 00001010 | Line Feed |
| CR | 13 | 0D | 015 | 00001101 | Carriage Return |
| 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 | Latin Capital A |
| Z | 90 | 5A | 132 | 01011010 | Latin Capital Z |
| a | 97 | 61 | 141 | 01100001 | Latin Small a |
| z | 122 | 7A | 172 | 01111010 | Latin Small z |
| ~ | 126 | 7E | 176 | 01111110 | Tilde |
| DEL | 127 | 7F | 177 | 01111111 | Delete |
| ยฃ | 163 | A3 | 243 | 10100011 | Pound Sign (ISO 8859-1) |
| ยฉ | 169 | A9 | 251 | 10101001 | Copyright Sign |
| ยฐ | 176 | B0 | 260 | 10110000 | Degree Sign |
| ยต | 181 | B5 | 265 | 10110101 | Micro Sign |
| โฌ | 8364 | 20AC | 20254 | 10000010101100 | Euro Sign (Unicode) |