BASE Function (LibreOffice Calc)
Convert numbers to base 2–36 text in LibreOffice Calc with BASE, including minimum-width padding, fractional-input behavior and the difference from column letters.
Verification status: Eight reference formulas and 9 diagnostic cases were recalculated through XLSX import in LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5. This is headless development-build evidence. The original single-example ledger separately records BASE(15;16)=F in LibreOffice 25.2.3.2. 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: =BASE(42;2) returns 101010.
What BASE returns
BASE represents a nonnegative number using positional digits in the chosen radix and returns text. Digits 0–9 represent values zero through nine; A–Z represent ten through thirty-five. The output uses uppercase letters. Padding changes the text representation without changing the represented number. See the official function reference and pinned LibreOffice calculation routine.
Syntax and arguments
=BASE(Number; Radix [; MinimumLength])
Two or three arguments are accepted. Number, Radix and MinimumLength undergo Calc’s approximate-floor conversion before validation. For ordinary nonnegative inputs this drops the fractional part; it does not round to the nearest integer. The resulting radix must be 2 through 36 and Number must be nonnegative. MinimumLength defaults to 1; zero is also treated as a minimum of 1. A shorter requested width never cuts off significant digits. A negative length is invalid; the inspected implementation also limits output length.
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. BASE results are text. This headless run does not establish stable-release or GUI behavior.
| Formula | Result |
|---|---|
=BASE(0;2) |
0 |
=BASE(42;2) |
101010 |
=BASE(42;8) |
52 |
=BASE(42;16) |
2A |
=BASE(35;36) |
Z |
=BASE(255;16;4) |
00FF |
=BASE(64;8;1) |
100 |
=BASE(12345;10) |
12345 |
Practical worksheet
Encode an existing identifier
With the integer identifier 255 in A2, enter =BASE(A2;16;4) in B2. The result is the text 00FF. Fill down for other identifiers. Keep the original numeric identifier in its own column, and export the code column as text when leading zeros matter.
To include a label, use ="ID-"&BASE(A2;16;4), giving ID-00FF. This is formatting an identifier that already exists. BASE does not make repeated input values unique, and a changing row number or random value is not a reliable permanent key.
Convert back for a check
For the same small, exactly represented integer, =DECIMAL(BASE(A2;16;4);16) returns 255. Leading zero padding has no effect on the recovered number. This round trip should use the same radix; it does not recover a fractional part discarded before conversion.
Advanced interpretation
Ordinary base 26 is not a spreadsheet column label
=BASE(1;26) returns 1, =BASE(10;26) returns A, and =BASE(26;26) returns 10. This system has a zero digit and uses digits 0–9 plus A–P. Spreadsheet column labels instead start A, B, …, Z, AA. They are a different numbering convention.
For a valid column number in A2, =SUBSTITUTE(ADDRESS(1;A2;4);"1";"") extracts the column letters from a relative A1-style address. With 27 it returns AA; this particular formula was also recalculated in the development-build run below. It is a column-address technique, not a different setting of BASE.
Work with binary positions
For a small nonnegative integer position k, =BASE(2^k;2) has one 1 followed by k zeroes. For k=5 the text is 100000. This describes one bit position; combining bit fields requires the appropriate arithmetic or bitwise operation first. A minimum width pads the left side, so =BASE(32;2;8) gives 00100000.
Calc stores numbers with finite floating-point precision. BASE cannot reconstruct integer digits already lost when a long identifier was read as a number, and its large-number conversion path has additional rounding considerations. Keep long external identifiers as text rather than using BASE as an arbitrary-precision encoder.
Boundaries and troubleshooting
A fractional input is not automatically an error: =BASE(3.14;2) produces 11 in the checked development build. Likewise the ordinary fractional arguments in =BASE(42.9;2.9;6.9) become 42, 2 and 6. If your data contract requires whole numbers, validate that contract separately instead of relying on BASE to reject fractions. The exact near-integer tolerance of approximate-floor conversion was not stress-tested here.
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 |
|---|---|
=BASE(3.14;2) |
11 |
=BASE(42.9;2.9;6.9) |
101010 |
=BASE(42;2;0) |
101010 |
=BASE(-1;2) |
Err:502 |
=BASE(42;2;-1) |
Err:502 |
=BASE(1;26) |
1 |
=BASE(10;26) |
A |
=BASE(26;26) |
10 |
=SUBSTITUTE(ADDRESS(1;27;4);"1";"") |
AA |
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.
Reproducible example (tested in LibreOffice Calc)
This standalone example was calculated in LibreOffice Calc 25.2.3.2 and matched the expected value. It is a practical cross-check of one usage, not proof that every example elsewhere on this page is correct.
=BASE(15;16)
Expected result: F.
Represent the number 15 as a hexadecimal digit.
If the result differs, check the referenced cells, argument separators and number formatting. For more information, consult the LibreOffice Calc official help.
This older single-example result is retained from the original test ledger. It was not rerun in that stable release, and it does not extend the development-build checks to LibreOffice 25.2.3.2.