DEC2OCT Function

Excel 2007+

Summary

The Excel DEC2OCT function converts decimal numbers to their octal (base-8) representation. This is particularly useful for programmers working with binary data, embedded systems developers, or anyone needing to display numbers in octal format for analysis or documentation purposes.

Syntax

DEC2OCT(number, [places])

Parameters

Parameter Type Required Description
number Number Yes The decimal integer you want to convert to octal. Negative numbers use 10-character two's-complement notation.
places Number No Optional: Number of characters to use in the result. Useful for padding with leading zeros.

Using the DEC2OCT Function

DEC2OCT is essential when working with low-level programming, file permissions (Unix-style octal), or legacy systems that use octal notation. Use it to convert decimal values for display, debugging, or when interfacing with systems that expect octal input.

Common DEC2OCT Examples

Basic Positive Number Conversion

=DEC2OCT(58, 3)

Converts decimal 58 to 3-digit octal: 072 (equivalent to 5*8 + 8 + 0)

Negative Number (Two's Complement)

=DEC2OCT(-100)

Converts -100 to 10-character octal using two's complement: 7777777634

Without Places Parameter

=DEC2OCT(9)

Returns minimum characters needed: 11 (no leading zero padding)

Frequently Asked Questions

Negative numbers return a fixed 10-character (30-bit) octal using two's complement notation, ignoring the places parameter.

Numbers must be between -536,870,912 and 536,870,911. Outside this range returns #NUM! error.

It pads the result with leading zeros to reach the specified length. If result needs more characters than specified, returns #NUM!.

Common Errors and Solutions

#NUM!

Cause: Number outside valid range (-536870912 to 536870911)

Solution: Use numbers within the 30-bit signed integer range

#NUM!

Cause: Places parameter is negative

Solution: Use positive integer or omit places

#NUM!

Cause: Result requires more characters than places specified

Solution: Increase places value or omit it

#VALUE!

Cause: Number or places contains non-numeric data

Solution: Ensure both arguments are valid numbers

#VALUE!

Cause: Places is non-integer

Solution: Places is truncated to integer, but ensure it's numeric

Notes

  • Maximum 30-bit precision (10 octal digits)
  • Negative numbers always return 10 characters regardless of places
  • Places < 0 returns #NUM! error
  • Non-integer places values are truncated
  • Perfect for Unix chmod permissions (0-777 range)

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2003 and earlier

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+