Text to octal converter — and octal bytes back to text

Type text to see every UTF-8 byte as a three-digit octal number, or switch to Octal → text to turn codes such as 110 151 041 back into readable text.

Live demo · real result from this tool
Direction

Result

110 145 154 154 157

Processed on your device — nothing is uploaded.

How to use the octal text converter

  1. Choose the Direction: Text → octal or Octal → text.
  2. Type or paste into Your text.
  3. Read the Result. When encoding, each byte appears as three digits with a space between bytes.
  4. To decode, paste octal numbers separated by spaces, commas or backslashes, or a run of three-digit groups with no separators at all.

What it does and when to use it

Octal is base 8: it writes numbers with the digits 0 to 7 only. Three octal digits cover one byte exactly (000 to 377), which is why older systems and some programming languages use it for raw bytes. You still meet octal escapes such as \303\251 in C and Python string literals, in printf output and in some mail and log files. This tool reads those escapes as text or makes them for a test string.

If you need a different base, the binary converter shows the same bytes as eight 0s and 1s, and the text to hex converter shows them as two hex digits. For the character numbers themselves rather than bytes, use text to ASCII codes or Unicode code points.

How it works

Text → octal. The text is first encoded as UTF-8 bytes with the browser’s TextEncoder. Each byte is written in base 8 and padded with leading zeros to three digits, so the exclamation mark (byte 33) becomes 041, not 41.

Octal → text. Backslashes are turned into spaces first. If the input then contains any space or comma, it is split there and each group can be any length (so 41 and 041 both mean byte 33). If there are no separators, the input is cut into groups of three digits. Any other character, such as 8 or 9, stops the decode with a message. Each group must be 377 or less, and the bytes must form valid UTF-8; nothing is guessed or silently replaced.

Everything runs in your browser. The text is not sent anywhere.

Worked examples

These outputs come from the tool itself:

Hi!               →  110 151 041
€5                →  342 202 254 065
\303\251 (decode) →  é
110151041 (decode)  →  Hi!
400 (decode)      →  Each octal group must be a byte (000–377).

In the second line the euro sign takes three bytes and the digit 5 takes one (065). The third line decodes a C-style escape. The last line fails because 400 in octal is 256, one more than a byte can hold.

Limits and tips

  • Encoding always uses spaces between bytes; there is no option for commas or backslashes. If you need \110\151 style, replace the spaces in the result with a backslash.
  • Drop leading zeros only when you keep separators. The run 41151 with no spaces is read as 411 and 51, and 411 is too large.
  • Octal is an encoding, not encryption. Anyone can turn it back into text.

Frequently asked questions

Why does one accented letter give two or three octal numbers?
The tool converts UTF-8 bytes, not characters. Letters A–Z, digits and common punctuation are one byte each, so they give one number. An accented letter such as é is two bytes (303 251), and the euro sign is three (342 202 254).
Can I paste octal without spaces?
Yes, as long as every byte is written with exactly three digits. Without any spaces or commas the tool cuts the input into groups of three from the left, so 110151041 reads as 110, 151, 041. If you drop leading zeros, keep a space between the groups.
What do the backslashes in \110\151 mean?
That is the octal escape style used in C strings, shell printf and some log files. The decoder treats each backslash as a separator, so \110\151 decodes to Hi just like 110 151.
Why do I get "These bytes are not valid UTF-8 text"?
The numbers are all valid bytes, but together they do not form valid UTF-8. A common cause is a missing byte. For example, 303 on its own starts a two-byte letter but never finishes it.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close