to

Text to Octal

✓ Free & no signup 🔒 Runs 100% in your browser Updated 2026-11-25 Binary Converter Tools

Octal text encoding is the quiet workhorse behind C string literals, old Unix logs, and plenty of debugging sessions. This tool converts any text into a sequence of octal byte values, live as you type: the word Hi becomes 110 151, where 110 is the octal form of the letter H's byte value and 151 is the i. Everything runs locally in your browser, so nothing you paste leaves your device, and the page is free, requires no signup, and works on mobile exactly as on desktop.

The crucial detail is bytes, not characters. The tool first encodes your text as UTF-8, then renders each byte as a three-digit octal number. For plain English text that means one octal group per character, matching the ASCII table. For anything else the byte count grows: an accented letter like é takes 2 bytes, so two octal groups; Chinese characters take 3 bytes; emoji take 4. One visible character never guarantees one group.

Why three digits per group? Because a byte holds values 0 through 255, and 255 in octal is 377, exactly three digits. Fixed three-digit width means every byte has a predictable slot, which is why C's backslash-octal escapes, such as the escape sequence for H, always use up to three octal digits and why this output aligns character for character with those literals.

What Octal Byte Values Actually Represent

Each group in the output is a number written in base 8. The group 110 means 1 times 64 plus 1 times 8 plus 0, which is 72 decimal, the ASCII value of capital H. The group 151 means 64 plus 40 plus 1, which is 105, lowercase i. The relationship with binary is direct: each octal digit is three bits, so 110 is the bit pattern 001001000, the same eight bits you would see in a binary converter, just written more compactly.

UTF-8 sits underneath. For the 128 ASCII characters, values 0 to 127, the octal groups match the classic ASCII table exactly: space is 40, capital A is 101, lowercase z is 172. Beyond ASCII, UTF-8's multi-byte sequences take over, and each continuation byte gets its own octal group. The é you see on screen becomes 303 251, two groups for one character, and that structure is precisely how the C escape sequences for non-ASCII text appear in source code and logs.

This notation was the standard way to represent arbitrary bytes in text contexts for decades, because octal digits are unambiguous, survive terminals and printers, and need only three characters per byte. Hexadecimal has largely taken over that role, but octal escapes remain built into C, shell tools, and syslog formatting, so you will keep meeting them whether or not you go looking.

How to Use This Tool (Step by Step)

  1. Type or paste your text into the input box. The octal output updates live with every keystroke; there is no convert button.
  2. Read the output as space-separated three-digit groups, one group per UTF-8 byte. Multi-byte characters simply produce more groups.
  3. Note the error handling: if input cannot be processed, the tool reports what went wrong rather than silently emitting partial output.
  4. Use the copy button to carry the result into source code, documentation, or homework.
  5. To reverse the process, paste the groups into the companion octal-to-text tool; the original characters, emoji included, come back exactly.

Worked Examples Worth Studying

These rows are handy for checking manual conversions and for classroom exercises on encodings.

Input textBytes (decimal)Octal output
Hi72, 105110 151
A65101
space32040
OK!79, 75, 33117 113 041
é195, 169303 251
中231, 169, 186347 251 272

The space row is a small but useful lesson: even invisible characters get a group, 040, which is why octal encoding faithfully records whitespace in logs where the space might otherwise be hard to see. The last two rows break the one-character-one-group intuition: é is two groups, and each Chinese character is three, because UTF-8 is variable length.

The C Escape Sequence Connection

In C and C++ source code, a backslash followed by up to three octal digits inside a string literal inserts the byte with that value. The escape sequence for capital H is backslash-one-one-zero, and the two escapes backslash-110 and backslash-151 embed the bytes that render as Hi. Compilers read at most three octal digits per escape, which is exactly the fixed width this tool outputs, so the tool's result can be dropped into string literals almost verbatim, group for group.

The same notation appears outside source code. Syslog and some log libraries emit non-printable bytes as octal escapes; the od and hexdump utilities print files in octal by default, a habit inherited from PDP-era Unix; and terminal tools sometimes echo control characters in octal. When a log line shows a cluster of three-digit groups where readable text should be, this tool decodes them instantly, which makes it a surprisingly effective first responder for log forensics.

Common Use Cases

  • Preparing C string literals: generate the octal escapes for control characters or non-ASCII bytes that cannot appear literally in source.
  • Teaching encodings: students see that Hi is two bytes, é is two bytes, and one Chinese character is three, all through one notation.
  • Log analysis: understanding what escaped sequences in syslog output actually contain, byte by byte.
  • Protocol debugging: serial devices and legacy protocols that document payloads in octal; paste the expected response and compare.
  • Puzzle and CTF layers: three-digit groups are a common encoding layer, and instant conversion keeps the chain moving.

How the Conversion Works Internally

Step one: the browser's TextEncoder converts your string into UTF-8 bytes, an array of numbers from 0 to 255. Step two: each number is converted to base 8 by repeated division. For 72: 72 divided by 8 is 9 remainder 0, then 9 divided by 8 is 1 remainder 1, then 1 divided by 8 is 0 remainder 1; reading remainders bottom-up gives 110. Step three: each octal value is padded to exactly three digits with leading zeros, so 33, the exclamation mark, becomes 041 rather than 41, and the groups are joined with spaces.

The padding is what makes reverse conversion unambiguous. Without fixed width, the string 110151 could split as 1 10 15 1 or any number of ways; with three digits per byte, the decoder always knows where each byte starts. This is the same discipline that makes C's escape parsing deterministic.

Tips and Best Practices

  • Round-trip your work: feed the output into octal-to-text and confirm the original string returns, including multi-byte characters.
  • Count groups to measure byte size; the number of three-digit groups equals the UTF-8 byte count, which is what file sizes and buffer limits actually measure.
  • When pasting into C code, remember the escape needs a backslash before each group; the tool provides the digits, the source provides the backslashes.
  • Do not strip leading zeros; 040 and 40 are the same value but only 040 keeps the three-byte alignment readable and machine-parseable.
  • For long documents, convert a sample paragraph first; giant inputs render slower, and a byte-count check on a sample usually answers the question already.
  • Remember octal is not secrecy: anyone with any converter can decode it, so never treat escaped bytes as protection.

Frequently Asked Questions

How do I convert text to octal by hand?
Look up each character's byte value, then convert that number to base 8. Capital H is decimal 72, and 72 divided by 8 repeatedly gives remainders 0, 1, 1, read bottom-up as 110. Lowercase i is 105, giving 151. So Hi becomes 110 151. Every byte must be written as exactly three octal digits, padding with leading zeros, because a byte maxes out at 255, which is 377 octal. Non-English characters need UTF-8 byte values first, where one character can be 2 to 4 bytes.
What is the octal value of Hi?
Hi is 110 151 in octal. Capital H has byte value 72, which is 110 in base 8, and lowercase i is 105, which is 151 in base 8. Each group is three digits because one byte spans 0 to 255 and 255 is 377 octal. The same bytes are 01001000 01101001 in binary and 48 69 in hex, all three notations describing identical data. These two letters are the standard worked example because they need both padding choices visible: 110 keeps its leading pattern and 151 stays three digits.
Why does é produce two octal groups when it is one character?
Because the tool encodes text as UTF-8 before converting, and é takes two bytes in UTF-8: 195 and 169 decimal, which are 303 and 251 in octal. One group per byte, not per character, is the rule. Accented letters, Greek, and Cyrillic characters typically take two bytes; Chinese, Japanese, Korean, and Arabic take three; emoji take four. This is exactly how C escape sequences and escaped log output represent the same characters, which is why the group count tells you the byte size at a glance.
How does this relate to C string escape sequences?
Directly. In C, a backslash followed by up to three octal digits in a string literal means the byte with that value: the escape for capital H is backslash-110. This tool outputs each byte as exactly three octal digits, matching the C parsing rule, so the output maps one-to-one onto escape sequences by adding a backslash before each group. The same notation appears in syslog output, the od and hexdump utilities, and terminal echo of control characters, which is why reading octal groups fluently pays off in debugging.
Is text-to-octal the same as using ASCII codes?
For basic English text, yes: the 128 ASCII characters keep identical values in UTF-8, so groups like 101 for A match any ASCII chart. The difference appears beyond ASCII, where a strict ASCII tool fails or mangles input while this tool shows the full multi-byte UTF-8 sequence: é becomes 303 251 and emoji become four groups. There is also a formatting difference from decimal code lists: octal uses three digits per byte, which aligns with C escapes, while decimal uses one to three digits with variable width.
Can I convert the octal output back to text?
Yes, using the companion octal-to-text tool on this site. Paste the three-digit groups there and the original characters return, including multi-byte UTF-8 characters and emoji, as long as every group is exactly three digits and the byte order is intact. Spaces between groups are readable formatting; the underlying data is the sequence of byte values. A quick round trip, text to octal and back, is the most reliable way to verify that an escape sequence you are about to embed in code or documentation is byte-exact.

Related Tools