Free Decimal to Octal Converter

Convert between decimal (base 10) and octal (base 8) numbers as you type

Type a decimal number to get its octal value as you type, or switch to Octal → Decimal to go the other way. Whole numbers up to 5,000 digits are converted exactly, negative numbers and fractions are supported, and you can convert a list of numbers at once or see the division steps. It all runs in your browser.

Negative NumbersFractionsBatch Conversion

Conversion Mode

Decimal Input

Tip: Supports negative numbers (e.g., -64), fractions (e.g., 123.45) and whole numbers up to 5,000 digits, converted exactly. Decimal 111 = Octal 157.

Educational Mode

Conversion History

Summary: convert decimal to octal, free and private

A decimal to octal converter rewrites a base-10 number in base 8, which uses only the digits 0 to 7. To convert decimal to octal free and privately, type the number into Decimal Input above, for example 111, and the result, 157, appears under Octal Output as you type. Nothing is uploaded: the conversion runs in your browser, and you can check that in the Network tab of DevTools.

By hand, divide by 8 over and over and read the remainders from bottom to top. Each remainder is the next octal digit, starting from the right. Written as a formula, the octal digits dįµ¢ of a number N satisfy N = Ī£ dįµ¢ Ɨ 8ⁱ. For the opposite direction, click Octal → Decimal or open the octal to decimal converter.

Table of Use: decimal numbers and their octal form

Decimal inputOctal resultWhat it shows
810The first number that needs two octal digits
255377The largest value of one byte
493755A Unix file mode reported as a plain decimal number
33188100644The st_mode of a regular file with mode 644 in Python or C
-64-100The minus sign is kept
0.50.44 Ɨ 8⁻¹ = 0.5, so this fraction ends
0.10.06314631463146314631Never ends in octal: cut off after 20 octal digits
123.45173.34631463146314631463Whole part by division, fraction by multiplication, cut off
123456789012345678901255245230635307605322Exact above 2⁵³
1 000 0003641100Spaces in groups of three, or underscores, are accepted

Octal gains a digit at every power of 8, just as decimal gains one at every power of 10. These are the rollover points:

PowerDecimalOctal
8⁰11
8¹810
8²64100
8³5121000
8⁓4,09610000
8⁵32,768100000

Features

  • Exact results. Whole numbers are converted with arbitrary-precision integers, up to 5,000 digits, so nothing is rounded above 2⁵³.
  • Fractions. Each fraction is multiplied by 8 repeatedly and stays exact. When it has no finite octal form, the result is cut off after 20 octal digits and a note says so.
  • Negative numbers. The sign is kept and the absolute value is converted. This is not two's complement.
  • Forgiving input. Leading zeros and plus signs, .5 and 5. are accepted, as are spaces in groups of three and underscores. A comma, a letter or a stray space gets an error message that says what is wrong.
  • Step-by-Step Calculation. In Single Value mode, Show Steps lists the division steps for the whole part, up to the first 64, and the multiplication steps for the fraction.
  • Batch Conversion. One number per line, with failed lines reported by line number.
  • Conversion History, Copy and Download. History holds your last 20 conversions in the open page; Download saves decimal-to-octal.txt, or octal-to-decimal.txt in the other direction. In Single Value mode, Swap converts the result back, which is a quick check; in Batch Conversion it only changes the direction. Reset clears the input.

Octal is one of several bases used in computing. To see the same number as bits, try the binary to text converter, the binary to hex converter or the hex to binary converter. For general arithmetic, the scientific calculator and fraction calculator are handy beside it.

How to Use the Decimal to Octal Converter

  1. Under Conversion Mode, keep Decimal → Octal selected.
  2. Choose Single Value, or Batch Conversion for a list with one number per line.
  3. Type or paste your number into Decimal Input, for example 255 or 0.1.
  4. Read the answer under Octal Output. A red message explains anything the tool cannot convert.
  5. Click Show Steps under Step-by-Step Calculation to see the working, or Show Explanation under Educational Mode for the method.
  6. Click Copy or Download to keep the result, Swap (in Single Value mode) to convert it back, and Reset to clear the input.

Who Can Use a Decimal to Octal Converter

Students of computer science and digital electronics check division and multiplication exercises against the steps. Linux and macOS users translate decimal mode values returned by scripts, such as os.stat in Python, into the octal form that chmod expects. Programmers writing C, Python or JavaScript literals convert a decimal constant to its octal spelling, and anyone preparing test data can feed a column of values, perhaps from the random number generator, through Batch Conversion. Hobbyists who read older computer manuals will also meet octal, and the ASCII to text converter and text to ASCII converter show where character codes fit in.

FAQs

How do I convert decimal to octal?

Divide the decimal number by 8 repeatedly, write down each remainder, and stop when the quotient is 0. Then read the remainders from bottom to top. For 111: 111 Ć· 8 = 13 remainder 7, 13 Ć· 8 = 1 remainder 5, 1 Ć· 8 = 0 remainder 1, so 111 is 157 in octal. The converter does this as you type and lists the steps if you click Show Steps.

How do I convert a decimal fraction to octal?

Convert the whole part by division, then multiply the fraction by 8 repeatedly. The whole-number part of each product is the next octal digit, and you keep the fractional part. So 0.5 Ɨ 8 = 4.0 gives 0.4. Many fractions never end: 0.1 becomes 0.0631463146…, so the converter cuts the result off, without rounding, after 20 octal digits and tells you it has.

Can I convert negative decimal numbers to octal?

Yes. The converter works on the absolute value and keeps the minus sign, so -64 in decimal is -100 in octal. It writes a signed number, not a two's-complement bit pattern, so it will not show how a negative value is stored in memory. A leading plus sign is accepted and dropped, and -0 is shown as 0.

How large a decimal number can I convert?

Up to 5,000 digits in total, counting both sides of a decimal point. The converter uses arbitrary-precision integers, so results stay exact beyond 2⁵³, which is 9,007,199,254,740,992, the point where ordinary JavaScript numbers start rounding. Longer input gets an error message instead of a wrong answer. Commas are rejected, but spaces in groups of three and underscores are accepted.

Why does octal only use the digits 0 to 7?

Octal is base 8, so it needs eight symbols, just as decimal needs ten and binary needs two. Each octal digit stands for exactly three binary digits, which made it a compact shorthand on older computers and still does for Unix file modes such as 755. Decimal 111 is 1101111 in binary, which splits into 1 101 111, or 157 in octal.

How do I convert decimal to octal in Python, JavaScript or the shell?

In Python, format(493, "o") returns 755 and oct(493) returns 0o755. In JavaScript, (493).toString(8) returns "755". In a Unix shell, printf "%o\n" 493 prints 755. Python's format and oct and the shell's printf handle whole numbers only. JavaScript's toString(8) also converts fractions, for example (0.5).toString(8) gives "0.4", but it works in double precision, so it rounds long fractions and loses precision above 2⁵³. For exact long numbers or the working, use this converter.

Can I convert a list of decimal numbers at once?

Yes. Click Batch Conversion and enter one decimal number per line. Each line becomes a result such as 64 (decimal) = 100 (octal). A line that is not a valid number is reported with its line number, for example "Line 3: Error", and the other lines still convert. Swap changes the direction for the whole list, so the same lines are then read as octal numbers; it does not convert the results back.

Is it safe to enter my numbers into this converter?

Yes. The conversion runs in your browser with JavaScript, and nothing you type is uploaded; the Network tab in your browser's DevTools will show no request carrying your numbers. Conversion History keeps your last 20 conversions in the open page only, and it is cleared when you reload or leave it.