ASCII to Octal Converter
Convert ASCII text to octal numbers and octal back to ASCII instantly. Supports all 128 ASCII characters with zero-padded octal output.
About
Every character transmitted across serial lines, embedded in firmware, or stored in legacy file systems reduces to a numeric code point. The octal (base-8) representation of ASCII was the dominant notation in early Unix systems, C escape sequences (\141 for the letter 'a'), and POSIX file permission masks (0755). Misreading a single octal digit turns a harmless newline (012) into a carriage return (015), corrupting protocol framing or terminal output. This converter maps each of the 128 standard ASCII code points (decimal 0 - 127) to its three-digit, zero-padded octal equivalent and reverses the process with strict validation. It also handles extended byte values up to 3778 (25510) for 8-bit character sets. The tool rejects digits 8 and 9 in octal input because they do not exist in base-8 arithmetic.
Formulas
The conversion from a character to its octal representation is a base transformation from decimal (base-10) code point to base-8 notation.
The decimal-to-octal algorithm uses repeated division:
Remainders read in reverse order form the octal digits. For standard ASCII (0 - 127), the result is zero-padded to 3 digits. For extended bytes (128 - 255), the result is also 3 digits (max 3778). For Unicode code points above 255, additional digits are produced as needed.
Reverse conversion parses each octal group back to decimal:
Where di is the i-th octal digit (from right), n is the number of digits, and the resulting c is passed to String.fromCharCode(c).
Reference Data
| Character | Name | Decimal | Octal | Binary | Hex |
|---|---|---|---|---|---|
| NUL | Null | 0 | 000 | 00000000 | 00 |
| BEL | Bell | 7 | 007 | 00000111 | 07 |
| BS | Backspace | 8 | 010 | 00001000 | 08 |
| TAB | Horizontal Tab | 9 | 011 | 00001001 | 09 |
| LF | Line Feed | 10 | 012 | 00001010 | 0A |
| CR | Carriage Return | 13 | 015 | 00001101 | 0D |
| ESC | Escape | 27 | 033 | 00011011 | 1B |
| SP | Space | 32 | 040 | 00100000 | 20 |
| ! | Exclamation | 33 | 041 | 00100001 | 21 |
| " | Double Quote | 34 | 042 | 00100010 | 22 |
| 0 | Digit Zero | 48 | 060 | 00110000 | 30 |
| 9 | Digit Nine | 57 | 071 | 00111001 | 39 |
| A | Uppercase A | 65 | 101 | 01000001 | 41 |
| Z | Uppercase Z | 90 | 132 | 01011010 | 5A |
| a | Lowercase a | 97 | 141 | 01100001 | 61 |
| z | Lowercase z | 122 | 172 | 01111010 | 7A |
| { | Left Brace | 123 | 173 | 01111011 | 7B |
| | | Vertical Bar | 124 | 174 | 01111100 | 7C |
| } | Right Brace | 125 | 175 | 01111101 | 7D |
| ~ | Tilde | 126 | 176 | 01111110 | 7E |
| DEL | Delete | 127 | 177 | 01111111 | 7F |