Text to Octal and Octal to Text Converter

Write each byte of your text as a three-digit octal number, or turn a list of octal byte values back into readable text. Works with UTF-8 and many legacy character sets.

Runs entirely in your browser. Nothing is uploaded.

How to use

  1. Choose Encode to convert text to octal, or Decode to convert octal values back to text.
  2. Type or paste the input, or open a file to convert its bytes.
  3. Select a separator for the output: space, none, comma or new line.
  4. Copy the result or download it as a file.

What is octal?

Octal, or Base8, writes numbers with the digits 0 to 7. Each octal digit stands for exactly three bits, which made octal popular on early computers whose word sizes were multiples of three, such as the 12-bit PDP-8 and the 36-bit PDP-10. Today it survives mainly in escape sequences and in Unix file permissions.

A byte holds a value from 0 to 255, which is 0 to 377 in octal. This converter writes every byte of the input as exactly three octal digits with leading zeros, so all groups have the same width and can even be joined without a separator. Text is first turned into bytes with the selected text encoding: one byte per character for plain ASCII, two to four bytes per character for other scripts in UTF-8.

Octal escape sequences

C, C++, Python, Perl and the shell's printf let you write a byte as a backslash followed by up to three octal digits: \101 is the letter A and \012 is a line feed.

This tool outputs plain digits without backslashes. To build an escaped string, take the space-separated output, replace each space with a backslash and add one in front of the first group. To decode escape sequences, do the reverse and replace the backslashes with spaces, because the decoder accepts only digits and separators.

File permissions such as 755 are octal too, but they are numbers, not text. To convert a number like that to binary or decimal, use the number base converter.

Octal in code

# Python
' '.join(f'{b:03o}' for b in 'Hi'.encode())            # '110 151'
bytes(int(o, 8) for o in '110 151'.split()).decode()   # 'Hi'

# Shell
printf '\110\151\n'        # prints Hi
printf 'Hi' | od -An -to1   # 110 151

Specification

Alphabet0-7
Output size3 digits per byte (300%)
PaddingNone
StandardPositional octal
Case sensitiveNo

Examples

Input (UTF-8)Output
Hello, World!110 145 154 154 157 054 040 127 157 162 154 144 041
Base64.is102 141 163 145 066 064 056 151 163
你好344 275 240 345 245 275

Frequently asked questions

Why does every byte have three octal digits?

The largest byte value, 255, is 377 in octal, so three digits are always enough. Padding smaller values with leading zeros keeps every group the same width, which is what allows a string without separators to be split back into bytes.

How do I decode octal without spaces?

Paste the digits as one continuous string. The decoder splits it into groups of three, so the length must be a multiple of 3. If some values have fewer than three digits, separate them with spaces, commas or line breaks instead.

Why is a value like 400 rejected?

Octal 400 is 256, which does not fit in a byte. Valid byte values run from 0 to 377, and the decoder reports the position of any group outside that range. The digits 8 and 9 are not valid octal digits at all.

Can I get octal values for a different character set?

Yes. Choose it in the Text encoding menu, for example Windows-1252 or ISO-8859-1 for one byte per Western European character, or GBK or Shift_JIS for Chinese and Japanese text.