OCT2DEC Function (LibreOffice Calc)
Learn the OCT2DEC function in LibreOffice Calc: Converts an octal number to a decimal number.
Verification status: Selected examples were executed in LibreOffice Calc 25.2.3.2. This does not establish that every formula and edge case was tested. How formula examples are checked
Quick answer
OCT2DEC converts an octal (base-8) input into a decimal number. For example, =OCT2DEC("144") returns 100 because (1×8^2 + 4×8 + 4 = 100). This is a numeric result, so you can sum, compare or format it like other numbers. The string "144" is octal notation, not the decimal number 144.
Exact LibreOffice Calc syntax and arguments
=OCT2DEC(Number)
Number — Required. An octal integer represented by a string of 0–7, up to 10 octal digits; a cell containing octal text also works.
The documented ten-digit limit uses a 30-bit signed two’s-complement interpretation. A full-width input with its sign bit set represents a negative value: =OCT2DEC("7777777777") returns -1, not 1,073,741,823. Positive and negative interpretations therefore depend on the encoded width, not on typing a minus sign. Official Calc analysis functions reference.
In English-language Calc formulas, arguments are separated with semicolons. This one-argument function has no separator inside its parentheses. In other locales, localized function names and argument-entry conventions may differ. Preserve leading zeroes by storing input codes as text, not automatically converted numbers.
Worked worksheet: octal device codes to decimal
Create a new Calc sheet. Type the following in text-formatted cells A2:A5 (or prefix each input with an apostrophe), then use the formula from B2 downward:
On a narrow screen, scroll this table sideways to see every column.
| Row | A: octal code (text) | B: formula | B: expected numeric result |
|---|---|---|---|
| 2 | 144 |
=OCT2DEC(A2) |
100 |
| 3 | 17 |
=OCT2DEC(A3) |
15 |
| 4 | 777 |
=OCT2DEC(A4) |
511 |
| 5 | 7 |
=OCT2DEC(A5) |
7 |
For B2, 144 is converted as 64 + 32 + 4. For B3, 17 is 8 + 7. With B2:B4 filled, =SUM(B2:B4) returns 626. This is a useful sanity check when an imported inventory contains octal codes but the reporting system expects decimals. The table, reference formula, and sum were executed in Calc 25.2.3.2 during editorial validation.
Advanced use: round-trip conversion and audit columns
=OCT2DEC(DEC2OCT(100)) returns 100, converting a decimal value to its octal text representation and back. For production data, keep the input and converted value in separate columns so you can spot invalid or suspicious identifiers before calculations. You can also compare =OCT2DEC("0007") with =OCT2DEC("7"): both return 7. Leading zeros are formatting of the code, not an increase in value.
Signed-code warning: "7777777777" is a ten-digit octal representation of -1. Do not treat it as an unsigned integer or strip digits from signed-width values. Conversion of an unsigned 30-bit quantity outside the signed domain requires a different approach, rather than assuming OCT2DEC will return its unsigned value.
Common errors and troubleshooting
| Problem | Explanation and remedy |
|---|---|
Err:502 with =OCT2DEC("8") |
Base 8 allows only digits 0 through 7; inspect copied values for digits 8 or 9. |
Err:502 with =OCT2DEC("ABC") |
Letters are not octal digits; clean the incoming data before conversion. |
Err:502 with eleven octal digits |
The documented input limit is 10 places; shorten or re-evaluate the encoding scheme. |
| Unexpected negative result | A ten-digit two’s-complement code may have the sign bit set. Check whether the source intended a signed encoding. |
| Values appear to have lost zeros | Enter/store code cells as text first; changing an already converted number to Text does not recover dropped characters. |
The first three errors above were observed as error code 502 in native Calc 25.2.3.2 testing. Examples on a different release were not executed.
Compatibility and alternatives
Microsoft Excel also documents an OCT2DEC function for converting octal inputs (see Microsoft’s base-conversion guide). In English-language Excel examples, function arguments use commas, while Calc documentation uses semicolons. Calc displayed Err:502 for the invalid cases tested; do not assume the exact same error labels, regional separators or import behavior in Excel. No Excel or Google Sheets workbook was executed for this guide. To convert decimal to octal instead, use DEC2OCT.
Related Calc guides
Sources, versions and validation
- LibreOffice 26.8 Help — OCT2DEC, Add-in Analysis Functions Part Two, accessed 2026-10-11: purpose, syntax, maximum ten octal places and signed interpretation.
- Microsoft Support — Convert numbers to different number systems, accessed 2026-10-11: Excel’s corresponding function and examples, documentation comparison only.
- Native execution: LibreOffice Calc 25.2.3.2 (headless UNO). The formula/result pairs and named invalid inputs above matched saved test results; the test script and spreadsheet are in this review batch. This is not a claim that LibreOffice 26.8, every locale, Excel, or any mobile deployment was executed.
How this guide was checked
Selected example formulas were run in LibreOffice Calc 25.2.3.2 on Linux on October 12, 2026. The official Help may cover a newer version. Tests of selected formulas do not certify every locale, interactive array operation or file round trip. View the example-check record.