Free Text to Octal Converter
The Text to Octal Converter turns readable text into octal byte values and back again. Choose your separator and handle multi-byte UTF-8 characters correctly.
The related conversions are the Text to Unicode Converter and the Number Base Converter, and Unicode to Text Converter reverses this in the other direction. If the octal came from a file dump, the Hex to Text Converter reads the neighbouring representation.
How to use the Text to Octal
- 1 Paste the text you want converted into the input area.
- 2 Choose whether each character is separated by a space and whether the leading zero is included.
- 3 Select a base for the surrounding format if the output needs to be pasted into code as an escape sequence.
- 4 Copy the converted result.
Where octal escapes turn up
Configuration files and command lines are the main habitat. A find command that matches filenames with spaces uses octal escapes, and so does the terminal output of a program dumping raw bytes. Recognising them means you can read output that would otherwise look like noise.
The second is in older source code and protocols, where a string literal may contain octal escapes for control characters. A tab or a carriage return written this way is common in code that predates modern escape syntax being standardised.
Reading octal output
- Group the digits in threes; a run without separators is nearly impossible to parse by eye.
- Control characters are in the low range — tab is 011, newline is 012, carriage return is 015.
- A leading 3xx usually means a byte with the high bit set, indicating a multi-byte character is starting.
- Keep the separators on until you are done reading, and remove them only if the destination requires a continuous string.
Frequently asked questions
What is an octal escape actually for?
Octal notation is how many traditional Unix tools write non-printable characters. A space in a filename, for example, is conventionally written as its octal escape so the shell treats it as part of the name rather than as a separator. That heritage is why octal survives in command-line contexts long after every other part of computing moved to hexadecimal.
How does one character become three digits?
Because each character is a code point, and its value is expressed in base eight. A byte needs eight bits, and eight bits is at most three octal digits — 377 is the largest. So a Latin-1 character always maps to a three-digit octal number, and the leading zero is only a convention to make the width uniform.
Does this handle characters outside the ASCII range?
Yes, by encoding them as UTF-8 first and converting each byte. That is why an accented letter or an emoji becomes several octal groups rather than one — it genuinely occupies more than one byte in UTF-8, and the escape sequence must reflect that or the resulting bytes will not decode to the character you started with.
Related Text Tools
You might also need
Tools from other categories that people pair with the Text to Octal: