Text to Octal

Octal is the forgotten cousin of hex: a base-8 numbering system where each digit represents exactly 3 bits. Unix file permissions (755, 644) are written in octal, and every character has an octal code just like it has a decimal and hex one. Paste text and this converter returns the octal code for each byte; paste space-separated octal codes and it gives the original text back.

How to convert text to octal

  1. 1

    Enter text

    Plain characters; UTF-8 encoding is assumed for non-ASCII input.

  2. 2

    Each byte becomes an octal code

    `A` = 65 decimal = `101` octal. `Z` = 90 = `132`. A space = 32 = `40`.

  3. 3

    Codes are space-separated

    Byte codes are joined with single spaces (`Hi` becomes `110 151`). No leading zeros are added.

  4. 4

    Decode by pasting octal

    Switch to Octal → Text and paste space-separated octal values; each value from 0 to 255 becomes one byte.

Octal quick examples

Character Decimal Octal Binary
A 65 101 1000001
a 97 141 1100001
0 48 60 0110000
space 32 40 0100000
\n 10 12 0001010

Why octal still matters

Most modern systems prefer hex because two hex digits equal one byte cleanly. Octal lingers in a few places:

  • Unix file permissions: chmod 755 means owner = 7 (rwx), group = 5 (r-x), other = 5 (r-x). Each digit is three permission bits.
  • C/Python escape sequences: \101 in a string literal is A. A leading zero in C integer literals (int x = 0755) is interpreted as octal, a known footgun.
  • Embedded and retro systems: older 12-, 18- and 36-bit architectures aligned nicely with octal.
  • umask values: umask 022 sets the default file permission mask to 755.

File permission table

Octal digit Permissions Binary
0 --- 000
1 --x 001
2 -w- 010
3 -wx 011
4 r-- 100
5 r-x 101
6 rw- 110
7 rwx 111

So chmod 644 = owner rw-, group r--, other r--, the default for a readable text file.

Gotchas

  • Leading zeros matter in C. int a = 010; sets a to 8, not 10. Python 3 dropped this; always use 0o10 instead.
  • Octal only uses digits 0-7. 8 and 9 are invalid in octal. If you see them, the source is not octal.
  • Unicode bytes get bigger in octal. A UTF-8 emoji (4 bytes) becomes 4 three-digit octal codes, twelve characters. Hex would be eight. Hex wins for most display purposes.

Frequently Asked Questions

Mostly never, unless you’re dealing with Unix permissions or C-string escapes that use \NNN format. Hex is more compact and easier to read byte-by-byte.

Because each octal digit corresponds exactly to three permission bits (read, write, execute). The notation was baked into AT&T Unix in 1971 and never left, it maps elegantly to the underlying bit pattern.

Yes. Switch to Octal → Text and paste space-separated octal values (for example 110 151). Each value from 0 to 255 is turned back into one byte, so multi-byte UTF-8 characters decode from their individual byte codes.

Your text is sent to our server only to perform the conversion and is not stored or logged.

Related Tools

Tool available in other languages