Text to Octal Converter (ASCII Codes)
This converter works on code values, one at a time, from the table. Codes are not capped, so values above 127 are accepted. For whole text rather than single codes, use Text to Binary; for a plain number, use Decimal to Octal.
Going the other way? Convert octal back to text →
How do you convert text to octal?
Text to octal conversion takes one code value from the 0–127 table and writes that number in octal, padded to 3 digits so every code is the same width.
- Read the code value. This example uses 65.
- Convert the number to octal: 65 is 101.
- Pad it on the left to 3 digits: 101.
- Repeat for every code in the list and separate them with a single space: A = 101.
Text to Octal Conversion Table
The codes this page works through, each with the character it stands for and the same value in hex, octal and binary. Find the code in the first column and read across; the row is the whole conversion. Codes 0 to 31 and 127 have no glyph, so the Char column shows their short name instead. This page writes one three-digit zero-padded octal code per character, single space between codes. This page shows the rows you need; ASCII code chart (decimal, hex, octal, binary) carries all 128.
| Dec | Char | Hex | Oct | Bin |
|---|---|---|---|---|
| 65 | A | 41 | 101 | 01000001 |
| 97 | a | 61 | 141 | 01100001 |
| 98 | b | 62 | 142 | 01100010 |
| 100 | d | 64 | 144 | 01100100 |
| 101 | e | 65 | 145 | 01100101 |
| 102 | f | 66 | 146 | 01100110 |
| 103 | g | 67 | 147 | 01100111 |
| 106 | j | 6A | 152 | 01101010 |
| 110 | n | 6E | 156 | 01101110 |
| 111 | o | 6F | 157 | 01101111 |
| 114 | r | 72 | 162 | 01110010 |
| 116 | t | 74 | 164 | 01110100 |
The base this page writes, defined by the digits it uses, how a value is marked, and what each position is worth.
| Base | Radix | Digits | Prefix | Place worth | Typical range |
|---|---|---|---|---|---|
| Octal | 8 | 0–7 | 0o | 8ⁿ | 3 digits cover a byte (000–377); Unix permissions 000–777 |
Worked Example: A to Octal
One code value, taken from the table and written out in full. This is the same working the converter shows when you turn on "show steps".
octal
Result: A = 101
Start with the code itself: 65. The table gives one row per code from 0 to 127, and that row is the whole answer — there is no arithmetic to get wrong, only a row to find. Reading the row across gives the same value in every base the table carries.
Writing 65 in octal gives 101, and the converter pads it on the left to 3 digits: 101. The padding is not decoration. It keeps every code the same width, so a run of codes can be split apart again later without a separator to guide it. A code typed in a different base lands on the same row, which is what the base selector is for.
Check it in reverse
The value looks the same read backwards. 101 maps to code 65, and code 65 maps to A — the table is a two-way lookup, not a calculation, so no rounding or padding can change the answer. To verify the result by hand, read those octal codes back as text and compare it with the code you started from.
Worked examples: text to octal
Each example gives the value first, then the working. Click a value to load it in the converter.
What is A in octal?
Text A is 101 in octal.
Method: code 65 written in octal is 101.
What is a in octal?
Text a is 141 in octal.
Method: code 97 written in octal is 141.
What is e in octal?
Text e is 145 in octal.
Method: code 101 written in octal is 145.
What is b in octal?
Text b is 142 in octal.
Method: code 98 written in octal is 142.
What is d in octal?
Text d is 144 in octal.
Method: code 100 written in octal is 144.
What is f in octal?
Text f is 146 in octal.
Method: code 102 written in octal is 146.
What is t in octal?
Text t is 164 in octal.
Method: code 116 written in octal is 164.
What is g in octal?
Text g is 147 in octal.
Method: code 103 written in octal is 147.
What is j in octal?
Text j is 152 in octal.
Method: code 106 written in octal is 152.
What is n in octal?
Text n is 156 in octal.
Method: code 110 written in octal is 156.
What is r in octal?
Text r is 162 in octal.
Method: code 114 written in octal is 162.
What is o in octal?
Text o is 157 in octal.
Method: code 111 written in octal is 157.
Every example above reverses exactly — read the same escapes back as characters.
What Changes the Code Output?
Values above 127
Values above 127 are accepted here, because this converter is not capped to ASCII. 233 is é and 8364 is €. the ASCII code chart in four bases lists the codes that ASCII itself defines.
Which base the code is written in
The same code can be typed as decimal, hex, octal or binary, and the base selector says which one you mean. 65, 41, 101 and 01000001 are all the letter A. Pick the wrong base and you look up a different row.
Control codes and printable codes
Codes 32 to 126 are printable characters; 0–31 and 127 are control codes. A control code has no glyph, so the table shows its short name instead — 10 is LF, 13 is CR. Converting one is valid; displaying one is not.
One code or a list
Several codes separated by spaces convert as a list, in order, and each keeps its own row. The separator is a display choice and does not change any value.
Text to Octal in Code
The same rule in one line. Both take code values and return their octal form.
Python: ' '.join(format(b, '03o') for b in s.encode('utf-8')) JavaScript: [...new TextEncoder().encode(s)].map(b => b.toString(8).padStart(3, '0')).join(' ') Common Mistakes
- Typing text where a code value belongs. The converter reads 72 as one code, not as the characters 7 and 2 — for whole text use convert text to binary.
- Reading a code in the wrong base. 41 is A in hex and ) in decimal.
- Expecting a character above 127. That value is outside ASCII and the answer depends on which extended set is meant.
- Dropping the padding on a fixed-width code, so a list of codes can no longer be split apart.
Frequently Asked Questions
Why are octal character codes three digits?
Because three octal digits cover every ASCII code, 000 to 177. ASCII defines 128 characters, codes 0–127, using 7 bits; in practice each code is stored in one 8-bit byte with a leading 0. This page writes one three-digit zero-padded octal code per character, single space between codes.
What is an octal escape sequence like \101?
\101 is how C, Python and many shells write a character by its octal code: \101 is A, because 101 in octal is 65. A is ASCII 65 = 0x41 = 0o101 = 0b01000001; a is 97 = 0x61 = 0o141 = 0b01100001. Uppercase and lowercase differ by 32, which is bit 5.
How do you convert an ASCII code to octal?
Divide the code by 8 twice and read the remainders, or take the Oct column of the table above. 65 in octal is 101, padded to three digits. Octal uses the digit set 0–7, each place worth 8ⁿ.
Every code here reverses: the same value converts straight back in the octal code to text direction.
Related Conversions
The rest of the family sits on all the number and text converters in one place.