DEC2OCT function

Converts a decimal number to its octal (base 8) representation, with optional zero-padding for fixed-width output.

=DEC2OCT(number, [places])

Generate a DEC2OCT formula

Describe what you need. The generator will reach for DEC2OCT where DEC2OCT is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How DEC2OCT reads its arguments
numberrequiredplacesoptionalDEC2OCT
ArgumentRequiredDescription
numberRequiredThe decimal number to convert to octal; must be an integer from 0 to 536,870,911. Negative numbers return #NUM! error.
placesOptionalThe desired number of characters in the output; leading zeros pad the result if needed. If omitted, the minimum number of characters is used. Must be a positive integer.

Returns

A text string representing the input decimal integer in base-8 notation.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Convert odometer reading to octal checksum

VehicleOdometerService DateCostGarage
V-101450002024-01-15250Main
V-102620002024-02-20385North
V-103327682024-01-10420South
=DEC2OCT(B2)

Result: 127710

Converting the first vehicle's odometer reading (45000 miles) to octal encodes it as a unique checksum for audit trails and legacy system compatibility. Decimal 45000 becomes 127710 in base 8, a common format for older fleet management databases.

2. Encode maintenance cost with fixed-width octal

VehicleOdometerService DateCostGarage
V-101450002024-01-15250Main
V-102620002024-02-20385North
V-103327682024-01-10420South
=DEC2OCT(D2, 6)

Result: 000372

The places parameter ensures all cost values are formatted to exactly 6 characters, padding with leading zeros as needed. This standardizes historical maintenance records that expected fixed-width octal encoding for data interchange with Unix-based systems.

3. Convert mileage milestone to padded octal archive

VehicleOdometerService DateCostGarage
V-101450002024-01-15250Main
V-102620002024-02-20385North
V-103327682024-01-10420South
=DEC2OCT(B3, 8)

Result: 00100000

Recording milestone odometer readings (like 32768, a power of 2) in padded octal preserves historical vehicle maintenance records in a compact, standardized format with consistent 8-character width. The elegant result 00100000 reflects the binary structure underlying octal notation.

Common errors

Which DEC2OCT error are you seeing?
DEC2OCT returned an error#NUM!
Use =DEC2OCT(ABS(D2)) to convert the absolute value, or validate source data to ensure it contains only non-negative values before conversion.
#VALUE!
Ensure the input cell contains a number by using =DEC2OCT(VALUE(A2)) if data is stored as text, or by extracting the numeric portion with NUMBERVALUE or similar functions.
#NUM!
Verify your input with =IF(B2>536870911, "Exceeds max", DEC2OCT(B2)) to catch large values, or use alternative functions like CONVERT or bitwise operations for extended-range encoding.
ErrorWhy it happensHow to fix it
#NUM!DEC2OCT does not accept negative decimal numbers; attempting to convert a negative value to octal (e.g., =DEC2OCT(-250)) produces this error.Use =DEC2OCT(ABS(D2)) to convert the absolute value, or validate source data to ensure it contains only non-negative values before conversion.
#VALUE!The number argument contains text, a date serial, or other non-numeric value that cannot be interpreted as a decimal integer (e.g., =DEC2OCT("V-101")).Ensure the input cell contains a number by using =DEC2OCT(VALUE(A2)) if data is stored as text, or by extracting the numeric portion with NUMBERVALUE or similar functions.
#NUM!The number exceeds the maximum supported value; DEC2OCT handles only integers from 0 to 536,870,911, and returns #NUM! for any value outside this range.Verify your input with =IF(B2>536870911, "Exceeds max", DEC2OCT(B2)) to catch large values, or use alternative functions like CONVERT or bitwise operations for extended-range encoding.

Tips and when to use something else

  • Use DEC2OCT when interfacing with legacy fleet management or Unix-based systems that expect octal notation—common in file permissions (chmod codes) and older data interchange formats.
  • The places parameter pads with leading zeros and is essential for fixed-width record formats; omit it if you only need the bare octal value without formatting.
  • To reverse the process, use OCT2DEC() to convert octal strings back to decimal—e.g., =OCT2DEC("127710") returns 45000, making it easy to round-trip between systems.
  • For comprehensive base-conversion workflows, combine DEC2OCT with DEC2BIN (binary), DEC2HEX (hexadecimal), and their inverses (BIN2DEC, HEX2DEC, OCT2DEC) to support multiple encoding systems.

Frequently asked questions

How do I convert an octal number back to decimal?
Use the OCT2DEC function: =OCT2DEC("127710") returns 45000. This is the direct inverse of DEC2OCT and lets you work between the two systems interchangeably when importing or exporting vehicle maintenance records.
What's the maximum number DEC2OCT can convert?
DEC2OCT supports decimal integers from 0 to 536,870,911, which converts to 3,777,777,777 in octal. Any number larger triggers #NUM! error; if you need larger values, consider bitwise operations like BITAND or alternative encoding schemes.
Can DEC2OCT handle negative numbers?
No; DEC2OCT rejects negative inputs with a #NUM! error. If you need to encode negative costs or mileage adjustments, use ABS() to convert to positive first, or maintain a separate sign field in your maintenance log.
When would I actually use octal in a fleet spreadsheet?
Octal is common in systems administration (Unix file permissions), legacy database formats, and historical data interchange standards. If your fleet data must integrate with older mainframe systems or Unix-based logistics platforms that expected octal-encoded costs and mileage, DEC2OCT bridges that conversion seamlessly.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17