HEX2BIN Function in ONLYOFFICE Spreadsheet Editor: Syntax, Examples and Troubleshooting
ONLYOFFICE HEX2BIN function guide: exact official formula syntax, argument defaults, practical hexadecimal to binary examples, width handling, error conditions, edition cautions and sources.
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
Convert a hexadecimal (base-16) numeral into binary (base-2) digits. Each hexadecimal digit represents four binary bits before leading zeros are removed. The documented formula is =HEX2BIN(number, [places]). For example, =HEX2BIN("2D") has the independently calculated expected result 101101, while =HEX2BIN("2D",8) has the expected result 00101101. See the official HEX2BIN reference, checked 2026-10-13 (UTC).
Evidence boundary: Every displayed output is an independent mathematical expectation unless labelled as a vendor-documented error rule. Native ONLYOFFICE Docs web or Desktop execution, localized parsing and historical-edition regression tests were not performed. Hexadecimal expectations use uppercase letters; native letter casing and cell formatting are not asserted.
What HEX2BIN does—and when to use it
Convert a hexadecimal (base-16) numeral into binary (base-2) digits. Each hexadecimal digit represents four binary bits before leading zeros are removed. This changes how an integer is represented; it does not rescale a measurement. As an example, decimal 45 can be written as binary 101101, octal 55, or hexadecimal 2D. Preserving fixed-width identifiers requires the optional places argument and careful cell formatting. The ONLYOFFICE function catalogue lists HEX2BIN in Engineering functions.
Use HEX2BIN when inspecting machine-generated flags, converting educational number-system examples, normalizing old identifiers, or preparing a fixed-width code for human inspection. It is not documented as a general parser for signed binary protocols, fractional numbers, textual prefixes like 0x, or arbitrary-length cryptographic bit fields. Those behaviors are not established by the linked function description.
Exact vendor syntax, arguments, types and defaults
=HEX2BIN(number, [places])
| Position | Argument | Required? | Official meaning | Documented default / limitation |
|---|---|---|---|---|
| 1 | number |
Yes | The hexadecimal (base 16) numeral, supplied directly or by cell reference. | The official help article requires a recognized base-16 numeral of 10 characters or fewer. Its full signed/large-number behavior is not specified. |
| 2 | places |
No | Desired count of digits in the binary (base 2) result. | If omitted, the function uses the minimum number of digits. If specified, it must be positive and large enough for the result, or the article documents #NUM!. |
Square brackets mark an optional parameter and are not entered literally. In the English-language reference, the first argument is always number; the optional second is places. Use parentheses and an initial = in a real spreadsheet formula. The official Insert functions guide illustrates comma-separated arguments; note that Advanced Settings offers formula-language and regional controls. Do not assume that a formula copied unchanged between localized editors always parses the same way.
Text input matters. Enter a base representation such as 00000101 as Text in cell B, or quote it as "00000101" inside a formula. Ordinary numeric auto-formatting can remove leading zeros before conversion. For a hexadecimal input containing A–F, quote the literal or store it in a text cell rather than treating it as a decimal numeric token. Upper/lowercase, leading/trailing spaces, signed inputs, noninteger places, and imported-type coercion should be confirmed in the target ONLYOFFICE edition; the checked reference is not an exhaustive behavior matrix.
Reproducible worksheet: 16 inputs and both output widths
- Open a blank ONLYOFFICE spreadsheet. Put
Use casein A1,Source hexadecimal (base 16)in B1,Placesin C1,Minimum outputin D1, andPadded outputin E1. Use these columns on an otherwise empty worksheet. - Format B2:B17 as Text before entering the source strings. Copy each source value from the table into B2:B17, preserving any leading zeros. Enter 8 into every C2:C17 cell. Do not type the backticks displayed in the article.
- In D2 enter
=HEX2BIN(B2); in E2 enter=HEX2BIN(B2,C2). Copy or fill both formulas through row 17. The source B and width C references will follow each row. - Compare the two result columns against the independently calculated expectations. Preserve the source values and record any differences with the Desktop/web edition, installed version, formula language, and region. The article does not imply these results were personally observed in ONLYOFFICE.
- If a value contains leading zeroes, inspect the formula bar and the cell type. If the minimum-width column lacks zeros but the padded column has them, that is the intended mathematical width distinction, not proof that a given editor preserves them as text.
| Row | Source B (Text) | Places C | D: expected minimum | E: expected padded |
|---|---|---|---|---|
| 2 | 0 |
8 | 0 |
00000000 |
| 3 | 1 |
8 | 1 |
00000001 |
| 4 | 2 |
8 | 10 |
00000010 |
| 5 | A |
8 | 1010 |
00001010 |
| 6 | F |
8 | 1111 |
00001111 |
| 7 | 10 |
8 | 10000 |
00010000 |
| 8 | 1A |
8 | 11010 |
00011010 |
| 9 | 2A |
8 | 101010 |
00101010 |
| 10 | 40 |
8 | 1000000 |
01000000 |
| 11 | 55 |
8 | 1010101 |
01010101 |
| 12 | 7F |
8 | 1111111 |
01111111 |
| 13 | 80 |
8 | 10000000 |
10000000 |
| 14 | 99 |
8 | 10011001 |
10011001 |
| 15 | FF |
8 | 11111111 |
11111111 |
| 16 | 01A |
8 | 11010 |
00011010 |
| 17 | 000F |
8 | 1111 |
00001111 |
Independent check: Convert each B value from base 16 to an exact integer and then render it in base 2. D is the minimal-width representation. E is that representation left-padded with zeroes to width 8. This is arithmetic verification, not a native spreadsheet test.
Copy-and-paste formula examples
The following literals do not require setting up the input table. Keep quotes around the input numeral so that intended leading zeros and hexadecimal letters are represented as text.
| Formula | Independent expected output | Decimal value for checking |
|---|---|---|
=HEX2BIN("A") |
1010 |
10 |
=HEX2BIN("A",8) |
00001010 |
10 |
=HEX2BIN("1A") |
11010 |
26 |
=HEX2BIN("1A",8) |
00011010 |
26 |
=HEX2BIN("FF") |
11111111 |
255 |
=HEX2BIN("FF",8) |
11111111 |
255 |
=HEX2BIN("000F",8) |
00001111 |
15 |
=HEX2BIN("0",8) |
00000000 |
0 |
The leading-zero strings are digit sequences, not decimal fractions. Changing places adds output zeros on the left, without changing the numeric value represented. For important reports, inspect the actual stored cell value, not only the displayed number format.
Advanced and practical applications
Decode a hexadecimal sensor value
Hex 2D is decimal 2 × 16 + 13 = 45. Its minimal binary form is 101101; =HEX2BIN("2D",8) is independently expected to produce 00101101, preserving an eight-bit display width.
Translate hexadecimal nibbles into a byte
Hex F0 decomposes to binary 1111 0000. =HEX2BIN("F0",8) has independent expected result 11110000. This makes it easier to inspect high/low nibble flags.
Round-trip and preserve width
=BIN2HEX(HEX2BIN("55",8),2) has independent expected result 55. The byte is decimal 85, so the minimal binary form is 1010101; padding to eight digits restores 01010101.
Compare with decimal route
=DEC2BIN(HEX2DEC("2D"),8) has independent expected result 00101101. Both nested functions have their own vendor references; use a native build to verify formula interoperability.
Errors, limits and troubleshooting
The official HEX2BIN article explicitly documents #NUM! if the numeral is not recognized in its stated base, if it has more than 10 characters, if the converted output needs more digits than places, or if places is less than or equal to 0. These are documentation claims, not a report of observed screen output. The following cases illustrate each published rule:
| Formula to check | Vendor-documented expected error class | Why |
|---|---|---|
=HEX2BIN("G1") |
#NUM! according to the official documented rule; not natively observed |
Invalid source-base input: G is not a valid hexadecimal digit. |
=HEX2BIN("00000000000") |
#NUM! according to the official documented rule; not natively observed |
11-character source numeral; the official page limits number to at most 10 characters. |
=HEX2BIN("FF",7) |
#NUM! according to the official documented rule; not natively observed |
The requested width is shorter than the independently determined converted numeral. |
=HEX2BIN("1",0) |
#NUM! according to the official documented rule; not natively observed |
The official page says places less than or equal to zero returns #NUM!. |
=HEX2BIN("1",-1) |
#NUM! according to the official documented rule; not natively observed |
A negative places value is also less than or equal to zero. |
Important distinction: A mathematical conversion tool can evaluate arbitrarily long positive integers, but the ONLYOFFICE reference states a 10-character input limit. Do not claim that an arbitrarily long integer, a 10-digit negative representation or a large signed value is supported merely because Python or another spreadsheet program calculates it.
Troubleshooting sequence
- Confirm the input base: Hexadecimal (base 16) only uses digits 0–9 and A–F. Check whether the cell holds the exact string, especially after CSV import. Remove prefixes and separators unless validated against a native build.
- Inspect the input length: more than ten characters is an official
#NUM!condition. The page does not resolve sign-bit behavior for every value within ten characters; use positive examples with clear bit length for initial troubleshooting. - Check output width: omit
placesto get the minimum-width representation. Withplaces, use a positive width that fits all converted digits; shorter requests are documented to produce#NUM!. - Verify entry language and punctuation: use the named function found in the editor’s Formula tab. English documentation uses commas; Advanced Settings lists a configurable formula language and regional settings. If the editor rejects a formula, check its active settings instead of blindly changing functions.
- Check text versus number types: protect significant leading zeros in the source. Check the actual result as a character sequence if your data exchange depends on fixed length. Do not treat a formatted-looking identifier as a numeric quantity.
- Isolate one cell: try
=HEX2BIN("2D")and compare with its independent expectation101101before nesting formulas. Save the workbook version, software build and locale when reporting a difference.
Boundaries that still require native validation
The English vendor article does not establish a complete table of allowed signed ranges, ten-character negative/two’s-complement interpretations, maximum practical places width, fractional-width coercion, hexadecimal letter case, whitespace handling, or specific spreadsheet error labels beyond its stated #NUM! cases. Large values can exceed the binary result length of a positive ten-bit number even when the input is within ten characters. Check those cases in the target edition before relying on them.
Version, edition and compatibility notes
The current unversioned ONLYOFFICE Docs Insert Functions catalogue lists HEX2BIN. The Docs changelog and Desktop Editors changelog are separate histories, so the existence of the help article does not establish that this function behaves identically in all web and desktop editions. The visible Docs changelog lists 10.0.0 (October 10, 2026) and the Desktop changelog lists 9.4.0 (May 19, 2026); these are product release dates, not function-introduction dates. The first supported release for HEX2BIN was not established during this review.
The documented English syntax uses comma argument separators. ONLYOFFICE Advanced Settings describes both Formula Language and Region; interface translations and regional numeric display may differ from these sample expressions. Formula interoperability with Excel, LibreOffice, Google Sheets, historical releases or third-party converters is not inferred from ONLYOFFICE documentation. Use an actual test sheet in each target product before promising equal behavior, particularly for negative codes, fixed width or unusual invalid inputs.
Frequently asked questions
Why did the leading zeros disappear? With places omitted, ONLYOFFICE’s official syntax description says the result uses the minimum required digits. Use a fitting positive places value to request a fixed width and keep the source identifier in a text-formatted cell.
Does HEX2BIN work for negative inputs? This review does not establish the interpretation of ten-character sign-bit or signed encodings in each edition. The official article documents input recognition and length but does not provide a complete negative-value behavior matrix. Native testing is required before asserting a particular output.
Can I use a 12-character code? The vendor specifically documents a #NUM! condition for more than ten characters. Use a different verified conversion method for longer codes and document its separate limitations; do not bypass the limit by assuming all base-conversion functions share the same range.
How can I tell whether a conversion is right? Check the base-16 positional weights to derive the exact decimal value, then divide that integer by base 2 to reconstruct the output digits. Use the independent expected table above as a control, and confirm results in your specific editor build before deployment.
Related official ONLYOFFICE documentation
The following vendor references describe related conversion functions and editor settings.
Claim-level sources, date and editorial verification
| Claim | Vendor source | Checked |
|---|---|---|
Function purpose, exact number, [places] syntax, optional default |
Official HEX2BIN help | 2026-10-13 UTC |
Input-recognition, ten-character limit, too-small/invalid places, #NUM! rule |
Official HEX2BIN help | 2026-10-13 UTC |
| Engineering category and instructions for entering function formulas | Spreadsheet Editor Insert Functions | 2026-10-13 UTC |
| Formula language and region settings | Advanced Settings | 2026-10-13 UTC |
| Web/Docs release chronology not first support date | Docs changelog | 2026-10-13 UTC |
| Desktop release chronology not first support date | Desktop changelog | 2026-10-13 UTC |
Verification limitations: Exact integer arithmetic verifies the positive examples. Error descriptions follow the vendor documentation; runtime errors, localized input and cross-edition compatibility have not been natively tested.