Text to Octal Converter, Free and Private
Convert text to the octal codes of its UTF-8 bytes, three digits per byte, and octal back to text in your browser. Any separator, ASCII check optional. Nothing is uploaded.
0 characters, 0 bytes
0 characters, 0 bytes
About converting text to octal
This page converts text to octal byte codes and octal back to text, in your browser. Octal, base 8, writes every byte as three digits from 000 to 377. It is the notation of Unix file permissions, of \110-style escapes in C, shell and Python strings, and of the classic od dump tool. Type or paste text and its UTF-8 bytes appear as octal on the right; paste octal and the text comes back. Nothing is uploaded, and your text never leaves your device.
How to convert text to octal
Steps
- Octal is pre-selected on this page. Type or paste your text on the left.
- Choose a Separator: a space between bytes is the usual dump style; None gives a continuous run such as
110151; Comma suits a list; Newline puts one byte per line. - Turn on ASCII only if the text must stay within plain ASCII. Any character above U+007F is then listed with its position instead of being converted.
- Press Copy, or press Swap to move the octal into the input and check that it decodes back to the same text.
Octal to text
Switch Direction to Codes to text and paste the octal. The decoder accepts spaces, commas and line breaks between bytes, an optional 0o prefix on each byte, and an unbroken run of digits whose length is a multiple of three, which it cuts into triples. A group with a digit 8 or 9, or a value above 377, cannot be a byte and is reported with its position. Octal that decodes to bytes which are not valid UTF-8 is reported as not being text.
Privacy
Everything happens in your browser. Your text is never sent to our servers and nothing is kept once the tab closes.
Reading octal
Three digits per byte
Each octal digit stands for three bits, so three digits cover nine bits, one more than a byte needs. That is why the first digit of a byte is never more than 3: the largest byte, 255, is 377 in octal. H is 110, i is 151, a space is 040 and a newline is 012.
UTF-8 bytes
Letters, digits and punctuation from an English keyboard are one byte each. An accented letter takes two bytes, so é becomes 303 251, and most emoji take four. The converter always shows UTF-8 bytes, which is what the web and modern programming languages use.
Octal escapes
C, shell printf and Python accept a backslash followed by up to three octal digits, so \110\151 spells Hi. To decode such a string, replace each backslash with a space and paste the result.
Common uses
- Writing octal escape sequences for a C string, a shell script or a test fixture.
- Reading the output of
od -bor an old protocol trace. - Teaching how base 8 maps onto bits, three at a time.
- Checking that a string contains only ASCII before it goes into a fixed-width record.
Related tools
The full Text to Binary converter also writes bytes in binary, decimal, hex, any base from 2 to 36 and as byte arrays. For hexadecimal pairs go to Text to Hex, and to convert a single number between octal, decimal and hex use the Number Base Converter.
Open-source credits
The conversion logic is implemented in-house in TypeScript, with no third-party library. Text is turned into bytes with the browser's built-in TextEncoder and TextDecoder, following the UTF-8 encoding defined in RFC 3629 and the WHATWG Encoding Standard. ASCII is the 128-character set of ANSI X3.4.