DECIMAL Function (LibreOffice Calc)
Parse unsigned base 2–36 text with LibreOffice DECIMAL. Learn accepted prefixes, leading-space behavior, sign errors and the difference from signed engineering converters.
Verification status: Eight reference formulas and 8 diagnostic cases were recalculated through XLSX import in LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5. This is headless development-build evidence. How formula examples are checked
Availability and version history
- Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
- Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
- Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
- Checked: 2026-10-14 — function reference; versioned support. Release availability is source-checked. The native examples below have their own named build and test scope.
Quick answer: =DECIMAL("52";8) returns 42.
What DECIMAL returns
DECIMAL reads a positional numeral and returns its numeric value. A–Z supply digit values ten through thirty-five, with lowercase accepted too. It is useful for converting small unsigned binary, octal, hexadecimal and other radix-coded strings into values that Calc can calculate with. See the official function reference and pinned LibreOffice calculation routine.
Syntax and arguments
=DECIMAL(Text; Radix)
Exactly two arguments are required. Text contains the digits in the selected base. Radix is approximately floored, then must fall from 2 through 36. Every digit must be valid in that radix, apart from the explicitly accepted prefixes or suffixes described below. A leading plus or minus sign is not accepted by the inspected Calc parser. The empty text string produces numeric zero.
Eight reproducible examples
These formulas were recalculated through XLSX import in LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5. Their saved results agree with independent calculations. DECIMAL results are numbers. This headless run does not establish stable-release or GUI behavior.
| Formula | Result |
|---|---|
=DECIMAL("101010";2) |
42 |
=DECIMAL("52";8) |
42 |
=DECIMAL("2A";16) |
42 |
=DECIMAL("Z";36) |
35 |
=DECIMAL("FF";16) |
255 |
=DECIMAL("100";8) |
64 |
=DECIMAL("0001";10) |
1 |
=DECIMAL("FFFFFFFFFF";16) |
1099511627775 |
Practical worksheet
Import a column of hexadecimal codes
Store the original codes as text in A2:A10. In B2 enter =DECIMAL(A2;16) and fill down. For 2A, FF and 0001, the results are 42, 255 and 1. Quoting a literal, as in =DECIMAL("FF";16), distinguishes text from a name or cell reference.
Keep a separate validation/status column if an empty source means missing data rather than zero. For example, =IF(A2="";"Missing";IFERROR(DECIMAL(A2;16);"Invalid code")) makes those conditions visible. Replacing every failure with zero would hide a valid zero’s distinction from a bad record.
Convert from one base to another
=BASE(DECIMAL("2A";16);2;8) gives the text 00101010: parse hexadecimal first, then format the resulting integer in binary. The optional width belongs to BASE, since DECIMAL returns a number rather than a padded string. The same pattern with "377", base 8 and output base 16 gives FF.
Advanced interpretation
Unsigned parsing is different from two’s-complement conversion
=DECIMAL("FFFFFFFFFF";16) returns 1099511627775. It interprets all ten hexadecimal digits as an unsigned magnitude. The specialized HEX2DEC convention interprets that ten-digit pattern as −1. Choose the parser using the data specification, not just the word “hexadecimal.” DECIMAL is therefore not an interchangeable replacement for every BIN2DEC, HEX2DEC or OCT2DEC case.
For a known unsigned hexadecimal value u encoding a 16-bit two’s-complement integer, first check that u lies from 0 through 65535. Then the interpretation is =IF(u>=32768;u-65536;u). For hexadecimal FFFE, u is 65534 and the signed interpretation is −2. The 16-bit width is an explicit assumption; it is not inferred by DECIMAL from leading characters.
Accepted notation and whitespace
For radix 16, the inspected parser accepts x or 0x prefixes and a final h; for radix 2 it accepts a final b. Thus 0xFF and FFh both mean 255, and 101b in radix 2 means 5. These conventions are radix-specific: a letter that is a valid digit in another radix is treated as that digit instead.
Leading ASCII spaces and tabs are skipped. A trailing space is not: " FF" works while "FF " errors. Cleaning input with TRIM is a deliberate normalization choice, not a description of DECIMAL’s own parser. Retain the raw text when auditing imported data.
Boundaries and troubleshooting
The parser rejects "-1010" in radix 2 rather than returning −10. It also rejects digits outside the selected base and unexpected punctuation. For very long numerals, the multiply-and-add calculation can exceed exact integer precision; a successful numeric result does not certify that every original digit remains recoverable. The examples below stay within exactly representable integer values.
Development-build checks
These additional cases were saved from the same recalculation. Error displays remain errors, not successful zero values.
| Formula | Native result or error |
|---|---|
=DECIMAL("-1010";2) |
Err:502 |
=DECIMAL(" FF";16) |
255 |
=DECIMAL("FF ";16) |
Err:502 |
=DECIMAL("0xFF";16) |
255 |
=DECIMAL("FFh";16) |
255 |
=DECIMAL("101b";2) |
5 |
=DECIMAL("";16) |
0 |
=DECIMAL("FF";16.9) |
255 |
Related functions
Evidence and checking scope
The LibreOffice 26.8.1.1 source establishes the inspected parser and argument rules. Native execution covers the eight reference formulas and listed diagnostics only in the named development build. A deliberately stale SUM cache changed from 999999 to 3, and an uncached SUM returned 7 after forced recalculation. Composite worksheet examples were independently checked; no broader stable-release, GUI or extreme-input test is inferred.