Text to Octal Converter (ASCII Codes)

A
65
101

octal

Show the working for octal → text

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.

  1. Read the code value. This example uses 65.
  2. Convert the number to octal: 65 is 101.
  3. Pad it on the left to 3 digits: 101.
  4. 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.

Text to Octal Conversion Table
DecCharHexOctBin
65A4110101000001
97a6114101100001
98b6214201100010
100d6414401100100
101e6514501100101
102f6614601100110
103g6714701100111
106j6A15201101010
110n6E15601101110
111o6F15701101111
114r7216201110010
116t7416401110100

The base this page writes, defined by the digits it uses, how a value is marked, and what each position is worth.

Base reference
BaseRadixDigits PrefixPlace worthTypical range
Octal80–7 0o8ⁿ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".

A
65
101

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.

Load this value in the converter

What is a in octal?

Text a is 141 in octal.

Method: code 97 written in octal is 141.

Load this value in the converter

What is e in octal?

Text e is 145 in octal.

Method: code 101 written in octal is 145.

Load this value in the converter

What is b in octal?

Text b is 142 in octal.

Method: code 98 written in octal is 142.

Load this value in the converter

What is d in octal?

Text d is 144 in octal.

Method: code 100 written in octal is 144.

Load this value in the converter

What is f in octal?

Text f is 146 in octal.

Method: code 102 written in octal is 146.

Load this value in the converter

What is t in octal?

Text t is 164 in octal.

Method: code 116 written in octal is 164.

Load this value in the converter

What is g in octal?

Text g is 147 in octal.

Method: code 103 written in octal is 147.

Load this value in the converter

What is j in octal?

Text j is 152 in octal.

Method: code 106 written in octal is 152.

Load this value in the converter

What is n in octal?

Text n is 156 in octal.

Method: code 110 written in octal is 156.

Load this value in the converter

What is r in octal?

Text r is 162 in octal.

Method: code 114 written in octal is 162.

Load this value in the converter

What is o in octal?

Text o is 157 in octal.

Method: code 111 written in octal is 157.

Load this value in the converter

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

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.

The rest of the family sits on all the number and text converters in one place.