Contact

HEX2BIN Function (Calligra Sheets)

Engineering Intermediate Calligra Sheets

Convert hexadecimal text into binary strings in Calligra, with minimum output width, letter-case handling and prefix-validation cautions.

Verification status: Selected formulas were executed through the Calligra Sheets 25.04.2 calculation engine library. No workbook-import or GUI-cell result is claimed; 26.08.2 was source-checked only. How formula examples are checked

Quick answer: =HEX2BIN("FF";10) gives 0011111111 in the tested Calligra calculation engine. Successful HEX2BIN results are text strings.

Availability and version history

  • Introduced: First release not established; the name is present in Calligra 2.4.0 source.
  • Supported in: Calligra Sheets 26.08.2, with no retirement established.
  • Scope: Desktop Sheets with the Engineering function module. Examples use English semicolon-separated formulas.
  • Checked: October 14, 2026. Formulas were executed through the official 25.04.2 engine library, with source and independent arithmetic checks. This is not GUI-cell or workbook-import evidence; 26.08.2 was source-checked, not executed.

What the result represents

HEX2BIN interprets hexadecimal digits and returns a base-2 text string. A–F correspond to values 10–15 and each hexadecimal digit can be expanded into four binary positions. The natural output omits unnecessary leading zeroes unless a minimum width is supplied. Function help.

Syntax and arguments

=HEX2BIN(hexadecimal[;places])

Hexadecimal is required and places is optional. The source wrapper accepts only a complete sequence of 0–9, A–F or a–f. It rejects signs, surrounding spaces and the 0x prefix even though the separate HEX2DEC parser can accept some of those forms. Brackets mark optional arguments and are not entered in a formula. Registration, implementation and versioned help.

Reproducible engine examples

These outputs were obtained through Calligra 25.04.2’s Formula parser and calculation library. The ordinary conversions also match independent positional arithmetic. Backticks preserve literal leading zeroes; they are not part of the entered result.

Formula Engine result
=HEX2BIN("0") 0
=HEX2BIN("A") 1010
=HEX2BIN("f") 1111
=HEX2BIN("10") 10000
=HEX2BIN("FF";10) 0011111111
=HEX2BIN("1CD") 111001101
=HEX2BIN("200") 1000000000
=HEX2BIN("FF";2) 11111111

Practical worksheet

Put the text FF in A2 and width 10 in B2. =HEX2BIN(A2;B2) returns 0011111111. There are eight significant binary digits plus two leading zeroes. Places counts the binary output characters; it is not the number of hexadecimal input digits.

Advanced checks and field widths

The recorded =BIN2HEX(HEX2BIN("01CD");4) returns 01CD. Converting the inner text to binary loses the original leading hexadecimal zero, so the final width of four restores it explicitly. The significant expansion of 1CD is 111001101.

The engine also converted hexadecimal 200 into 1000000000. A minimum width smaller than the required output is ignored as a lower bound: HEX2BIN("FF";2) still gives 11111111. Validate a destination field’s maximum capacity separately rather than trimming the result.

Input boundaries and error cases

Both uppercase and lowercase digit strings work, but “G”, “-1”, surrounding whitespace and “0xFF” returned #VALUE! in the recorded tests. Negative width produced no extra padding and a fractional width was converted to an integer. Long decoded inputs are later narrowed by the shared text-conversion helper, so a valid hexadecimal string is not proof of unlimited output-range support.

The following engine results show the specific inputs tested. They do not establish every text-format, locale or import rule.

Formula Engine result
=HEX2BIN("G") #VALUE!
=HEX2BIN("-1") #VALUE!
=HEX2BIN(" FF ") #VALUE!
=HEX2BIN("0xFF") #VALUE!
=HEX2BIN("F";-1) 1111
=HEX2BIN("A";6.9) 001010

Range and verification limits

The shared text-conversion helper narrows the numeric input to a C++ int before formatting it. These small integer examples do not establish safe conversion of arbitrary large identifiers. Validate the intended value and field width before export; do not assume another spreadsheet’s numeric limits or signed convention.

The Engineering module and conversion helper are byte-identical in the inspected 25.04.2 and 26.08.2 source files. That supports the source comparison, but does not turn these engine tests into execution of a newer binary or confirmation of its UI/import behavior.