Octal to Decimal Converter – Free

Use this octal to decimal converter to turn a base-8 whole number into the base-10 value people and most APIs expect. Large inputs are converted exactly, with no rounding.

How to use the Octal to Decimal tool

  1. Enter an octal whole number in the Base-8 number box, for example 644.
  2. Select Convert, or select Example to run the built-in sample 55.
  3. Read the decimal value in the Result box.
  4. Select Copy to copy the number, or Clear to reset.

The octal to decimal formula

Octal is positional, like decimal, but each place is worth eight times the place to its right: 1, 8, 64, 512, 4096 and so on. Multiply every digit by its place value and add the products.

The converter uses the equivalent left-to-right method. It starts at zero and, for each digit, multiplies the running total by 8 and adds the digit. For 755 the totals are 7, then 7 x 8 + 5 = 61, then 61 x 8 + 5 = 493.

755 = 7*64 + 5*8 + 5*1 = 448 + 40 + 5 = 493
55  = 5*8 + 5*1                    = 45
644 = 6*64 + 4*8 + 4*1 = 384 + 32 + 4 = 420

Where octal values need decoding

Octal survives in a few corners of everyday development, and each one tends to surface as a confusing decimal number somewhere else.

  • File modes. A chmod of 755 is stored as the integer 493, which is what you see when a mode is logged or serialized as a plain number.
  • umask values such as 022, which is 18 in decimal.
  • Octal escapes in strings: \101 is character code 65, the letter A, and \033 is 27, the escape character.
  • Integer literals with a leading zero in C, C++, Java and Go, where 010 means eight.
  • Size and mode fields in tar archive headers, which are stored as octal text.

Input rules and error messages

The field accepts one whole number written with the digits 0 to 7. You may add a minus sign, a 0o prefix or leading zeros. Surrounding whitespace is trimmed, and the total length may not exceed 4,096 characters.

A digit 8 or 9, a space inside the number, a decimal point or a plus sign stops the conversion and names the offending character, for example Invalid base-8 digit: 9. An empty field, or a prefix with nothing after it, returns Enter a base-8 whole number.

Exact results for large numbers

Many quick conversions go through 64-bit floating point and silently lose precision above 2^53. This tool uses JavaScript BigInt arithmetic throughout, so every digit of the answer is correct. The 22-digit octal number 1777777777777777777777 converts to 18446744073709551615, the largest unsigned 64-bit integer.

Frequently asked questions

What is 777 in octal as a decimal number?

It is 511. The calculation is 7 x 64 + 7 x 8 + 7 = 448 + 56 + 7. In binary that is nine 1 bits, which is why mode 777 grants read, write and execute to everyone.

Why does 010 equal 8 in some languages?

C, C++, Java and Go read an integer literal that starts with 0 as octal, so 010 is one eight and zero ones. Python 3 rejects that spelling and requires 0o10. This converter always treats the field as octal, with or without a leading zero.

How do I convert a negative octal number to decimal?

Type a minus sign before the digits. The tool converts the magnitude and keeps the sign, so -12 returns -10. It does not interpret a bit pattern as two's complement.

Why do I get an invalid base-8 digit error?

Octal has only the digits 0 through 7. The message appears when the input contains 8, 9, a letter, a space, a comma or a decimal point, and it shows the first character that could not be read.

Why would a file mode show up as 493 or 420?

Those are the decimal forms of 755 and 644. Tools that print a mode as an ordinary integer, for example a JSON API or a debugger, hide the octal digits. The Decimal to Octal tool converts such a value back so you can read the permission bits.

Is my number sent anywhere?

No. The conversion is plain JavaScript running on this page. Nothing you enter in the Base-8 number box leaves your browser.

Related tools