Convert text to octal

Paste any text and get the matching octal representation back. The text to octal converter walks every character, takes its UTF-16 char code, and writes that number in base 8. By default each chunk is zero-padded to three digits and separated by a single space, so the output reads as a clean stream of bytes. Toggles drop the padding or remove the spaces. The transform runs in your browser; nothing uploads.

Input
Line 1:1 LF cloud_done Saved locally
Result Text to Octal
0 lines 0 chars

Text to octal, plain and predictable

Text to octal encoding walks every character of your input, reads its UTF-16 char code with charCodeAt, and writes that integer as a base-8 string. ASCII characters (codes 0 through 127) fit in three octal digits or fewer, Latin-1 characters fit in three (since 255 is 377), and the rest of the Basic Multilingual Plane fits in up to six. The default behaviour zero-pads every chunk to three digits, which is the form most octal-to-text decoders expect.

Two toggles change the output shape. Pad Bytes, on by default, zero-pads every chunk to at least three octal digits with padStart(3, "0") so ASCII characters always emit a clean byte. Turn it off to emit the minimum number of octal digits per character. Separate, on by default, puts a single space between every chunk so the output reads as a stream of bytes. Turn it off to emit a continuous run of octal digits with no delimiter.

Octal is less common than hex or binary in modern systems, but it shows up in Unix file permissions (chmod 0755), legacy mainframe formats and a few embedded devices. Encoding text as octal is a useful step when interfacing with those systems. For the inverse direction, see octal to text.

How to use convert text to octal

  1. 1Paste your text into the input panel on the left.
  2. 2The octal stream appears in the output panel on the right as you type.
  3. 3Toggle Pad Bytes to zero-pad short chunks to three digits.
  4. 4Toggle Separate to insert a space between chunks.
  5. 5Click Copy in the output header to copy the result.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

UTF-16 char codes via charCodeAt

Each character is read with charCodeAt(0), which returns the UTF-16 code unit value. ASCII text encodes to values 0 through 127, Latin-1 to 0 through 255, and the rest of the Basic Multilingual Plane to up to 65535. Above-BMP characters encode as two 16-bit surrogate code units, one chunk each.

Pad Bytes toggle (default on)

On by default. Zero-pads every chunk to at least three octal digits with padStart(3, "0") so ASCII characters always emit a clean byte. Turn off to emit the minimum number of octal digits per character. With padding off, \n (char code 10) emits as 12, not 012.

Separate toggle (default on)

On by default. Inserts a single space between every chunk so the output reads as a stream of bytes. Turn off to emit a continuous run of octal digits with no delimiter. Continuous output needs Pad Bytes on to round-trip without a known chunk width.

Three digits cover every byte

A single byte (0 through 255) needs at most three octal digits, since 255 is 377. With padding on, every byte-sized character emits as a clean three-digit chunk, which makes the stream regular and easy to parse downstream.

Runs entirely in your browser

No upload, no server-side processing, no log of what you pasted. The encode runs on every keystroke via a single JavaScript pass. Long inputs of a few hundred kilobytes still encode in under a second on a desktop browser.

Worked example

Two characters become two three-digit octal chunks: H is char code 72 (110), i is char code 105 (151).

Input
Hi
Output
110 151

Settings reference

Setting or rule Effect on output
Separate (default on) Inserts a single space between chunks. Turn off for a continuous run of octal digits.
Pad Bytes (default on) Zero-pads each chunk to at least three octal digits. Turn off to emit minimum width.
Encoding UTF-16 code unit value of each character via charCodeAt, then toString(8).
ASCII characters Encode in 1-3 octal digits. Pad Bytes on always emits three digits.
Latin-1 characters Always fit in three octal digits since 255 is 377.
Above-byte characters Need more than three octal digits. With padding on, the chunk grows to the next sufficient width.
Empty input Emits an empty string.

FAQ

Why three digits per character?
Three octal digits cover every byte: 255 in octal is 377, the maximum for a single byte. Padding to three digits keeps ASCII output regular and round-trippable to a fixed-width octal decoder. Without padding, a low char code like 10 (\n) would emit as 12 instead of 012, which is ambiguous in a continuous stream.
What does Separate do?
When on, a single space goes between every chunk so the output reads as a stream of bytes. When off, the output is a continuous run of octal digits with no delimiter. The decoder accepts both forms, but the continuous run needs Pad Bytes on to round-trip without a known chunk width.
When is octal the right choice?
Octal shows up in Unix file permissions (chmod 0755), legacy mainframe formats, some embedded device protocols, and the occasional textbook problem. Hex is more common in modern systems for byte-level work; binary is more common in embedded and low-level code. Use octal when the downstream tool expects it.
Is the text sent anywhere?
No. The encode runs entirely in your browser via JavaScript. Nothing is uploaded, nothing is logged, no record of your text exists on our servers.
How do I go the other way?
Paste your octal stream into octal to text. That tool splits on whitespace, parses each chunk as base 8, and emits the matching character via String.fromCharCode.