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 writes each byte of the text as 3 octal digits, the form C and shell escapes use, so an ASCII character is one code and é is two.
The letter A is octal 101. Find each character's code (A is 65), write it in base 8, and pad it to three digits, the form C and shell escapes such as \101 use.
- Take the first character and find its code in the table: A is 65.
- Write that code in octal: 65 is 101.
- Pad it on the left to 3 digits: 101.
- Repeat for every character, spaces included, and separate the codes with a single space: A = 101.
Text to octal pads each code to three digits; the binary converter list shows the text pairs that pad to eight bits or two hex digits instead.
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".
Result: A = 101
Take the first character, A. Its row in the ASCII table is 65. Written in octal that is 101, padded on the left to 3 digits: 101.
The codes are joined in the order the characters were typed, one space apart. A character past the table is written as its UTF-8 bytes, so é is two codes, 303 251.
Check it in reverse
Read it back and you arrive where you started: 101 is code 65, and code 65 is the letter 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 value 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: A is code 65 in the table, written in octal as 101.
What is a in octal?
Text a is 141 in octal.
Method: a is code 97 in the table, written in octal as 141.
What is e in octal?
Text e is 145 in octal.
Method: e is code 101 in the table, written in octal as 145.
What is b in octal?
Text b is 142 in octal.
Method: b is code 98 in the table, written in octal as 142.
What is d in octal?
Text d is 144 in octal.
Method: d is code 100 in the table, written in octal as 144.
What is f in octal?
Text f is 146 in octal.
Method: f is code 102 in the table, written in octal as 146.
What is t in octal?
Text t is 164 in octal.
Method: t is code 116 in the table, written in octal as 164.
What is g in octal?
Text g is 147 in octal.
Method: g is code 103 in the table, written in octal as 147.
What is j in octal?
Text j is 152 in octal.
Method: j is code 106 in the table, written in octal as 152.
What is n in octal?
Text n is 156 in octal.
Method: n is code 110 in the table, written in octal as 156.
What is r in octal?
Text r is 162 in octal.
Method: r is code 114 in the table, written in octal as 162.
What is o in octal?
Text o is 157 in octal.
Method: o is code 111 in the table, written in octal as 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 as UTF-8 bytes, because this converter is not capped to ASCII: é is two bytes, 303 251. The codes ASCII itself defines are listed in the ASCII code chart in four bases.
Which base the code is written in
The same code can be written in decimal, hex, octal or binary: 65, 41, 101 and 01000001 are all the letter A. This page writes octal only, so a code in another base names 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, commas or new lines 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 a string and return one octal code per byte.
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 a code instead of text. Here 72 is read as the characters 7 and 2, codes 55 and 50, not as code 72. To turn a whole message into bits instead, use the text to binary code translator.
- Reading a code in the wrong base. 41 is A in hex and ) in decimal.
- Expecting one code per character above 127. Each code here is a byte, so é is two codes, 303 251.
- 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.