FormatterHQ

Octal to Decimal Converter

Convert octal numbers to decimal instantly. Ideal for permission modes, octal escape codes and legacy data. Accepts 0o prefixes, leading zeros and fractions.

Loading tool…
Ready.

How to use the Octal to Decimal Converter

  1. Type an octal number in the Octal field, using digits 0–7.
  2. Leave any 0o prefix or leading zero in place; both are accepted.
  3. Read and copy the decimal value from the Decimal field.

Octal to decimal converter

This octal to decimal converter turns base-8 numbers into ordinary base-10 values. You will need it when a program, API or config format wants a file mode as a plain integer, or when you meet octal constants in older code.

Place values in base 8

From the right, octal places are worth 1, 8, 64, 512 and 4096. Multiply each digit by its place value and add up the results.

755 = 7 × 64  +  5 × 8  +  5 × 1
    = 448     +  40     +  5
    = 493

After an octal point, places are worth 1/8, 1/64 and so on. 17.4 is 8 + 7 + 4/8 = 15.5, and 0.1 in octal is exactly 0.125.

Example

Input    Output
12       10
377      255
644      420
755      493
0o777    511
17.4     15.5

Why convert permissions to decimal?

JSON has no octal numbers, and several libraries take a file mode as a normal integer. If you write 755 where octal is expected but decimal is read, you get a very different mode. Converting first avoids that: chmod 644 is 420, 755 is 493 and 777 is 511.

The reverse trap exists in C, where a leading zero makes a literal octal. 0755 in C is 493, while 755 is seven hundred fifty-five. Python 3 refuses the ambiguous form and requires 0o755, and JavaScript's parseInt("0755") returns 755 because it reads the string as decimal.

Input rules

  • Only digits 0–7 are valid. An 8 or 9 means the value was not octal, and the tool reports an error naming it.
  • A 0o prefix and leading zeros are fine: 0755, 755 and 0o755 all give 493.
  • Spaces and underscores are ignored, the field holds one number at a time, and integers of any size convert exactly.

Quick reference

A few values come up again and again: octal 10 is 8, 100 is 64, 1000 is 512 and 2000 is 1024. The common umask 022 is 18 in decimal, and applying it to 0777 clears the group and other write bits, leaving the default directory mode 755, or 493.

Where octal still turns up

Octal has mostly given way to hexadecimal, but it survives in a few places where you may need the decimal value:

  • Escape sequences. \033[31m starts red text in a terminal. Octal 33 is decimal 27, the Escape character, the same byte as \x1b.
  • tar archives. The classic tar header stores file size, mode and modification time as octal text. A size field of 00000001750 means 1,000 bytes.
  • od dumps. The Unix od command prints octal by default, so its offsets and byte values need converting before they match other tools.
  • Aircraft transponder codes. Squawk codes use only the digits 0 to 7, which is why there are 4,096 of them rather than 10,000. The emergency code 7700 is 4032 in decimal.

Related tools

Use decimal to octal to go back. To see which permission bits a mode sets, octal to binary expands every digit into its read, write and execute bits, and the all number converter gives the value in several bases at once.

Convert octal to decimal in Python

In Python, int("755", 8) converts an octal string to decimal, and the string may carry the 0o prefix. For a value written directly in source code, use an octal literal such as 0o755; oct() goes the other way. What catches people is dropping the prefix. A bare 755 is the decimal number seven hundred fifty-five, so os.chmod(path, 755) passes a mode that is 1363 in octal, not the rwxr-xr-x that was intended.

print(int("755", 8))     # 493
print(int("0o17", 8))    # 15, the 0o prefix is accepted
print(0o755)             # 493, an octal literal in source code
print(oct(493))          # 0o755, decimal back to octal

# The classic slip: 755 without the prefix is a decimal number
print(oct(755))          # 0o1363, the mode os.chmod(path, 755) would set

Paste a list of octal values into the converter above to confirm what your script should print, or use the chmod calculator when the number is a file permission.

Frequently asked questions

What is 777 in decimal?
Octal 777 is 511 in decimal: 7 × 64 + 7 × 8 + 7. It is the mode that grants read, write and execute to everyone.
Why does the converter reject 8 and 9?
Octal only has the digits 0 to 7. A number containing 8 or 9 is not a valid octal number, so the value was probably decimal to begin with.
Is 0755 the same as 755 in octal?
Yes, leading zeros do not change the value, and both convert to 493. The leading zero only matters in source code, where some languages use it to mark octal.
How do I convert an octal fraction?
Give the digits after the point the weights 1/8, 1/64 and so on. 17.4 is 15 + 4/8 = 15.5, which the converter shows directly.

Last updated October 3, 2026

Guides

Related tools