BIN2HEX Function (OpenOffice Calc)
Convert signed binary codes to hexadecimal in Apache OpenOffice, with ten-digit sign rules, padding examples and exact returned strings.
Verification status: Eight reference formulas and 7 diagnostic cases were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, using XLSX import and GUI hard recalculation. Saved formula identities and typed results were checked. How formula examples are checked
Quick answer: =BIN2HEX("11111111") returned FF in the tested Apache OpenOffice 4.1.16 build.
Availability and version history
- Introduced: First release not established; documented by OpenOffice.org 3.3.
- Supported in: Apache OpenOffice 4.1.16; this identifies a verified release, not a final supported version.
- Scope: Desktop Calc with its Analysis add-in, English function names and semicolon-separated formulas.
- Checked: October 14, 2026. Eight reference formulas and the listed diagnostics were recalculated after XLSX import in 4.1.16 on Linux x86-64, Build 9816. Source and independent reference calculations were also checked.
What BIN2HEX returns
BIN2HEX reads a binary digit string under Calc’s fixed-width signed convention and returns uppercase hexadecimal text. A binary input of exactly ten digits beginning with 1 is negative; a shorter input beginning with 1 is ordinarily positive. Release entry.
Syntax and arguments
=BIN2HEX(BinaryNumber [; Places])
BinaryNumber contains at most ten digits, each 0 or 1. Its decoded range is −512 through 511. Optional Places requests positive-result padding and must convert to an integer from 1 through 10. A negative result uses the ten-hex-digit two’s-complement representation; Places still has to pass its validity check.
Reproducible examples
The native column records the saved 4.1.16 results. Text-returning conversion strings are retained exactly, including leading zeroes and uppercase hexadecimal letters. OCT2DEC, IMREAL and IMAGINARY return numeric values. These integer and quarter-unit references agree exactly with the saved results; errors are checked by display rather than interpreted from a numeric zero cache.
| Formula | Native 4.1.16 result | Independent reference |
|---|---|---|
=BIN2HEX("0") |
0 |
0 |
=BIN2HEX("1") |
1 |
1 |
=BIN2HEX("10") |
2 |
2 |
=BIN2HEX("11111111") |
FF |
FF |
=BIN2HEX("111111111") |
1FF |
1FF |
=BIN2HEX("1000000000") |
FFFFFFFE00 |
FFFFFFFE00 |
=BIN2HEX("1111111111") |
FFFFFFFFFF |
FFFFFFFFFF |
=BIN2HEX("101010") |
2A |
2A |
Practical worksheet
=BIN2HEX("101010") returns 2A, because the binary input represents decimal 42. For a positive code needing a four-character field, =BIN2HEX("1010";4) returns 000A. Leading zeroes are characters in the returned text, not extra numeric precision.
The nine-digit code 111111111 is +511 and returns 1FF. The ten-digit code 1111111111 is −1 and returns FFFFFFFFFF. Adding one leading digit can therefore change signed interpretation rather than merely add a visual column.
Advanced interpretation and checks
The source decodes the input value before re-encoding it. Ten-bit binary 1000000000 represents −512. Its hexadecimal result is the forty-bit encoding 2^40−512, written FFFFFFFE00; it is not simply a grouping of the original ten bits into hex digits.
For a positive value, grouping bits in blocks of four offers an independent check: 0010 1010 corresponds to 2 A. For negative values, first account for the source sign width and the wider output sign extension.
Keep the input cell formatted as text if leading zeros or exact digit counts matter. Numeric-looking codes can lose leading zeros during import before the function sees them.
Boundaries and troubleshooting
A Places value shorter than the positive output raises an error instead of truncating digits. A valid small Places value does not shorten a negative ten-digit output, but zero Places is still invalid. Nonbinary characters and inputs longer than ten characters are rejected. An empty string is decoded as zero by this number-base helper.
These additional formulas were recalculated through the same import path. Error displays are retained as errors, even when an ODS numeric attribute stores zero.
| Formula | Observed result or error |
|---|---|
=BIN2HEX("1010";4) |
000A |
=BIN2HEX("111111111";2) |
Err:502 |
=BIN2HEX("1111111111";1) |
FFFFFFFFFF |
=BIN2HEX("1111111111";0) |
Err:502 |
=BIN2HEX("2") |
Err:502 |
=BIN2HEX("") |
0 |
=BIN2HEX("00000000000") |
Err:502 |
Other spreadsheet implementations
The BIN2HEX guide for Gnumeric documents that product’s own syntax and tested behavior. A shared function name does not guarantee the same argument conversion, text parsing, branch or precision rules.
Official evidence and checking scope
- Function-specific release entry
- Conversion or strict complex parser
- Signed positional decoder
- Width conversion
The saved ODS retained every tested formula identity. A deliberately stale SUM cache changed from 999999 to 3, and an uncached SUM returned 7 after hard recalculation. Native evidence covers the eight reference formulas and listed diagnostics only. Other explanatory compositions are independent mathematical checks; other releases, locales and extreme-value behavior were not established by this run.