Contact

BASE Function in ONLYOFFICE Spreadsheet Editor: Syntax and Examples

Math and Trigonometry Intermediate ONLYOFFICE Spreadsheet Editor

Turn a nonnegative integer into binary, hexadecimal or base-36 text; preserve leading zeros and validate arguments.

Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked

Quick answer

=BASE(number, radix, [min_length]) converts a nonnegative integer to text representing that integer in base 2 through 36. For example, =BASE(255,16) is expected to return the string FF. To get eight binary digits, =BASE(42,2,8) is expected to return 00101010. The final argument is optional: when it is supplied, leading zeroes pad the text string to that minimum length. ONLYOFFICE BASE reference, accessed 2026-10-13.

Use this to display binary flags, hexadecimal identifiers, base-36 codes and zero-padded fixed-width export values. It does not change the stored base of a number: the output is text, not a binary number that a spreadsheet can add in base 2.

Syntax: argument order, required fields and documented bounds

=BASE(number, radix, [min_length])

Do not type the brackets surrounding the optional argument. They denote optional syntax, not literal formula characters.

Argument Required? ONLYOFFICE’s documented requirement Sample
number Yes Integer 0 <= number < 2^53 (9,007,199,254,740,992 exclusive) 255 or numeric cell A2
radix Yes Integer base from 2 to 36, inclusive 2, 8, 16, 36
min_length No Integer 0 to 255, inclusive. Zero-pad the result if shorter than this width. 8

The official reference does not specify a default numeric min_length, a complete error-code map, or how every older build processes fractional arguments. Omission means no requested extra leading-zero padding; do not assume other applications’ numeric-coercion rules are identical. Official BASE argument table.

Version, edition and locale scope

The English function index and BASE article were checked on 2026-10-13. They are not version-pinned and do not state the first supporting ONLYOFFICE Desktop or Docs version. The ONLYOFFICE Docs changelog is separate from the Desktop Editors release history. An advertising banner mentioning 10.0 is not a function-specific compatibility test.

  • Docs web/server: present in the common official Spreadsheet Editor documentation; native execution was not performed.
  • Desktop Editors: minimum supported build and identical error handling are not verified. Do not claim every Desktop release supports this function.
  • Mobile, connectors and imported XLSX: not run, so compatibility is unverified.
  • Locale: these copy-ready examples use English function names, a leading equals sign and comma argument separators. Formula language and regional settings are configurable in Advanced Settings; check the actual separator before pasting. Bases and digit strings in these examples avoid decimal punctuation.

Reproducible worksheet setup

Enter the following headers in A1:C1: Value, Target base, Minimum length. Set column A to an ordinary numeric format, not text. Leave empty cells truly blank rather than typing the words blank or none.

Row A: Value (number) B: Target base C: Minimum length Purpose
2 255 16 0 Hexadecimal value
3 42 2 8 Fixed-width binary
4 4095 16 6 Left-pad hexadecimal
5 35 36 0 Last one-character digit
6 0 2 4 Zero padded to four digits
7 123 10 6 Decimal-looking text
8 100 16 0 Decimal 100 in hex

Put =BASE(A2,B2,C2) in D2 and fill through D8. The expected text values are respectively FF, 00101010, 000FFF, Z, 0000, 000123, and 64. These expected strings come from independent integer-base conversion and the documented padding rule; they were not observed in ONLYOFFICE.

Ten reproducible formula checks

Formula to type Expected output Why
=BASE(255,16) text FF 15×16 + 15 = 255
=BASE(42,2,8) text 00101010 Binary 101010 padded to eight digits
=BASE(4095,16,6) text 000FFF FFF padded to six characters
=BASE(35,36) text Z Base 36 uses digits 0–9 and A–Z
=BASE(0,2,4) text 0000 Single zero padded to four characters
=BASE(123,10,6) text 000123 Base 10 string with width 6
=BASE(100,16) text 64 6×16 + 4 = 100
=BASE(31,2) text 11111 Five 1 bits sum to 31
=BASE(A3,B3,C3) text 00101010 Row 3 inputs: 42, 2, 8
=DECIMAL(BASE(255,16),16) number 255 Converts text hex back into a decimal number

Results are reasoned expectations, not native ONLYOFFICE screenshots. The last check uses the separately documented DECIMAL function, and assumes normal text composition between the two functions in the target build. To reproduce the checks, enter the formulas into empty cells outside A:D, using the worksheet values above.

Advanced workflow: fixed-width hexadecimal identifiers

For a dataset of item identifiers stored as numbers in A2:A100, place =BASE(A2,16,6) in a new column to produce six-character hexadecimal tags when the representation needs no more than six characters. Larger results are not truncated by the documented padding rule: min_length specifies a minimum, not a maximum.

If another application expects a numeric decimal identifier, use the numeric source value; if it expects a hexadecimal string, export the resulting text rather than allowing an import wizard to strip leading zeroes. BASE is useful for representation, not a security encoding and not unique-ID generation.

For debugging an existing hex code FF stored as text, =DECIMAL("FF",16) is expected to give 255. The two functions have opposite directions; DECIMAL’s first input is base-encoded text, while BASE starts from a decimal number. ONLYOFFICE DECIMAL reference.

Errors, limits and troubleshooting

Invalid base: radix must be an integer 2–36, not 1, 37, or an unsupported base name such as "hex". Invalid width: min_length must be an integer from 0 to 255; do not use 256 or negative widths. Invalid value: negative and non-integer values fall outside the BASE number specification. Test the target build rather than asserting which specific error code it returns: the ONLYOFFICE help page provides constraints but not a complete error-code table.

Unexpected arithmetic: if BASE(255,16) looks like FF, it is text, not a quantity that can be directly summed as decimal. Convert back with DECIMAL before arithmetic. Lost leading zeroes: keep the output column as text when exporting. Large integers: the documented strict upper bound is 2^53; very large values should be processed with a library or application that guarantees arbitrary precision, not coerced through a floating-point spreadsheet.

Wrong pasted formula: use the function name BASE, not DECIMAL, when converting from a decimal numeric value. Check the user’s Formula Language setting if an English formula name is not recognized; a locale can also change list separators. Advanced Settings.

Compatibility with Excel and Google Sheets

Microsoft’s BASE reference and Google Sheets’ BASE reference separately document the same basic number → base-coded text operation and zero-padding concept. This is documentation-based syntax compatibility, not a claim that all three engines agree on fractional coercion, precision edges, errors, locale parsing or every version. Microsoft additionally specifies truncation for non-integer input, but ONLYOFFICE’s article instead requires an integer: do not transfer the Microsoft rule without a native ONLYOFFICE test.

Verification limitations

Official syntax, bounds and padding were checked on 2026-10-13. All conversions are independent expectations. Native Desktop/web/mobile execution, localized parsing, precision boundaries and historical release support remain untested.