1. Home
  2. Developer tools
  3. Octal to Decimal

Octal to Decimal

Paste an octal number and get its decimal value, with the sum of digit times power of eight written out. It is quick for checking exercises and for reading old Unix mode values.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Octal to Decimal

  1. Enter octal numbers, one per line.
  2. Read the decimal value and the place-value sum.
  3. Copy it, or view the binary and hex forms.

Features

  • Place-value working for each digit
  • Octal fractions convert exactly when they end
  • Accepts 0o prefixes and separators
  • No size limit
  • Names invalid digits such as 8 and 9
  • Lists binary and hex too

Supported formats

Input

  • Octal numbers
  • Typed or pasted numbers

You get

  • Decimal
  • Place-value working

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Octal to Decimal is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Numbers are read in the base named by the tool, so a digit outside that base is reported instead of guessed.
  • A leading zero does not mark octal here: the base is the one you chose.

Guide

From octal to decimal using powers of eight

Reading an octal number as an ordinary decimal quantity is a small calculation, but it is easy to get wrong when the digits look like something you know. A string such as 755 or 644 is a number in decimal and a mode in octal. Here you choose the base, type the digits, and get the decimal value with the sum laid out.

The positional sum

The rightmost octal digit counts ones, the next counts eights, then sixty-fours, then five-hundred-and-twelves. In general the position n (counting from zero on the right) is worth 8 to the power n. Multiply each digit by its worth and add them. For 3062 octal that is 3 × 512 + 0 × 64 + 6 × 8 + 2, which equals 1,586.

What the working displays

The numbered lines show each digit, its power of eight and the product, and finish with the total. The box beneath gives the same number in binary, hexadecimal and base 36. Because each octal digit is three bits, the binary line is a handy check: it should be the three-bit patterns of your digits joined together.

Where octal still appears

Octal turns up in Unix file permissions, in escape sequences within C strings such as \033 for the escape character, in tar headers, and in manuals for older computers. If you are decoding one of those, convert the digits and keep in mind that the number often stands for a set of flags rather than a quantity. In a permission mode the decimal value is rarely meaningful by itself.

Edge cases

An 8 or a 9 cannot occur in octal, so the page stops and names the offending character. Fractions are accepted: octal 0.4 is 4/8, or 0.5. Negative numbers keep a minus sign. A long octal string is no problem because the page does not use floating-point numbers, but the working is long, so switch it off if you only want the result. Leading zeros are allowed and ignored, so 0755 and 755 give the same answer here.

A worked example

The Sample button loads 755. The terms are 7 × 8² = 448, 5 × 8¹ = 40 and 5 × 8⁰ = 5, and the sum is 493. In binary this is 111101101, and in hexadecimal it is 1ED. If you need to read it as a permission mode, ignore the 493: it is just the number seven hundred fifty-five written in base 8, and the useful reading is owner rwx, group r-x, others r-x.

Limits

The page is arithmetic only. It does not know whether you are decoding a mode, a character escape or a quantity, and it does not warn about leading zeros that might mean something in another language. Verify the interpretation against the documentation of the system that produced the number. For permission work the chmod calculator is a better fit than a base converter.

Checking your answer

There are two quick checks for any conversion on this page. First, the size of the result: a three-digit octal number lies between 64 and 511 in decimal, a four-digit one between 512 and 4,095, and so on, because each added digit multiplies the range by eight. Second, the parity: an octal number is odd exactly when its last digit is odd, because every higher place value is even. Both checks take seconds and catch most slips made when converting by hand.

Checked against the current version of the Octal to Decimal on .

Frequently asked questions

Why does a number with a leading zero behave oddly in some programming languages?

In C, Java and older JavaScript a literal such as 017 is octal, so it equals 15, not 17. Python 3 and strict-mode JavaScript reject the form and require 0o17. Always check how your language reads a leading zero before you rely on it.

How is octal 17 related to decimal 15?

The digit 1 is in the eights place and the digit 7 is in the ones place, so the value is one eight plus seven ones, which is fifteen. Octal 10 is eight, the first number that needs a second digit, because the single digits stop at 7.

How is 17 octal converted?

1 × 8 + 7 × 1 = 15. Octal 17 is therefore decimal 15, not 17.

Why do some programs treat 0777 as octal?

C-family languages read a leading zero as octal. Python 3 and modern JavaScript require 0o777 instead, because the leading-zero form caused many mistakes.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.