DEC2OCT in Google Sheets: Formula & Examples

How-to basics · Updated November 23, 2026

The Google Sheets DEC2OCT function converts a decimal number (base 10) into its signed octal (base 8) representation. The syntax is DEC2OCT(decimal_number, [significant_digits]), where decimal_number is required and significant_digits is optional.

What Does DEC2OCT Actually Do?

Octal is a base-8 number system that uses digits 0 through 7. It was historically common in computing because each octal digit maps neatly to three binary bits. The DEC2OCT function takes a decimal integer you provide and returns the equivalent octal string. For example, =DEC2OCT(8) returns 10, because 8 in decimal is written as 1×8¹ + 0×8⁰ in octal.

The function belongs to Google Sheets’ Engineering category, alongside other number-system converters like DEC2BIN, DEC2HEX, OCT2DEC, and BIN2OCT. It is designed for technical users who need to work with different numeral systems, often for low-level programming, digital logic design, or legacy data formats.

How to Use DEC2OCT in Google Sheets

Using the function is straightforward. In any cell, type:

=DEC2OCT(10)

This returns 12, because 10 decimal equals 12 octal (1×8 + 2). You can also reference a cell containing the number:

=DEC2OCT(A2)

If cell A2 contains 255, the formula returns 377 (3×64 + 7×8 + 7).

The optional significant_digits argument pads the result with leading zeros to a specified minimum length. For instance:

=DEC2OCT(8, 4)

returns 0010. If the octal result already has more digits than the specified significant_digits, the function returns the full result without truncation. If significant_digits is zero or negative, Google Sheets returns a #NUM! error.

Understanding Signed Octal Output

The official documentation describes DEC2OCT as converting to signed octal format. This matters for negative decimal numbers. In Google Sheets, if you input a negative decimal number, the function returns a 10-character octal string that represents the two’s complement of the number in 30-bit binary form, then converts that to octal.

For example:

=DEC2OCT(-1)

returns 7777777777 (ten 7s). This is because -1 in 30-bit two’s complement is all 1s in binary, which is 7777777777 in octal. Similarly, =DEC2OCT(-8) returns 7777777770. The function only accepts negative numbers down to -536870912 (which is -2^29) and positive numbers up to 536870911 (2^29 – 1). Trying to convert a number outside this range yields a #NUM! error.

Common Errors and How to Fix Them

You may encounter several errors when using DEC2OCT:

  • #NUM! – The decimal number is outside the allowed range (-536870912 to 536870911), or significant_digits is negative or zero.
  • #VALUE! – The decimal_number argument is not a valid number (e.g., text like “abc”). If you pass a cell containing text, the function returns this error.
  • #N/A – This rarely appears, but can happen if you reference a cell that contains an error.

To avoid these, ensure your input is a numeric value and within the valid range. If you need to convert a larger number, consider splitting it or using a custom formula with BASE (which handles larger positive numbers but not negatives).

DEC2OCT vs. Other Number Conversion Functions

Google Sheets offers several related functions. Here’s how they compare:

  • DEC2BIN – Converts decimal to binary (base 2). Useful for bit-level operations.
  • DEC2HEX – Converts decimal to hexadecimal (base 16). Common in color codes and memory addresses.
  • OCT2DEC – The reverse: converts octal back to decimal.
  • BASE – A more flexible function that converts a decimal number to any base between 2 and 36, but it does not handle negative numbers or provide signed output.

For most users, BASE is simpler for positive numbers. For example, =BASE(255, 8) returns 377 just like DEC2OCT. However, BASE does not support the significant_digits padding option, and it errors on negative inputs. DEC2OCT is the only built-in function that gives signed octal representation.

Practical Examples and Use Cases

Here are a few real-world scenarios where DEC2OCT might be used:

  1. Unix file permissions – File modes are often expressed in octal (e.g., 755). If you have a decimal permission value, you can convert it quickly. For instance, =DEC2OCT(493) returns 755 because 493 decimal equals 755 octal.
  2. Legacy data processing – Some older data formats store numbers in octal. If you receive a decimal list and need to match an octal-based system, this function helps.
  3. Digital logic design – When documenting truth tables, converting decimal states to octal can make patterns more readable.

Suppose you have a list of decimal numbers in column A (A2:A10). To get their octal equivalents, enter in B2:

=DEC2OCT(A2)

Then drag the fill handle down. For consistent 4-digit output, use:

=DEC2OCT(A2, 4)

Frequently Asked Questions

Does DEC2OCT work with decimal fractions?

No. DEC2OCT only accepts integers. If you enter a number with a decimal part, Google Sheets truncates it toward zero. For example, =DEC2OCT(8.9) returns 10 (as if you entered 8). It does not round; it simply drops the fractional part.

Why does DEC2OCT(-1) return 7777777777?

Because Google Sheets uses a 30-bit signed two’s complement representation for negative numbers. -1 in binary is all 1s, which in octal is ten 7s. This is a standard computer representation, not a bug.

Can I convert octal back to decimal in Google Sheets?

Yes, use the OCT2DEC function. For example, =OCT2DEC("377") returns 255. The syntax is OCT2DEC(octal_number), where the octal number can be a string or a cell reference.

Is there a way to convert decimal to octal without a formula?

You can use the BASE function for positive numbers: =BASE(255, 8) returns 377. Alternatively, you can manually calculate by dividing by 8 repeatedly, but that’s tedious for large numbers.

What is the maximum number DEC2OCT can handle?

For positive numbers, the maximum is 536870911 (2^29 – 1). For negative numbers, the minimum is -536870912 (-2^29). Beyond these, the function returns a #NUM! error.

Does DEC2OCT work on mobile or Excel?

Yes, DEC2OCT works in the Google Sheets mobile apps and in Excel (where it is also available). In Excel, the syntax and behavior are identical, though Excel’s help documentation may describe it slightly differently. The function is part of the Engineering functions in both applications.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.