HEX2DEC Function (Gnumeric)
Learn the HEX2DEC function in Gnumeric: Converts a hexadecimal number to a decimal number.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
HEX2DEC converts a hexadecimal representation into a decimal number. Hexadecimal uses sixteen digit values, 0–9 and A–F. Quoted text is the clearest input, especially when a code contains letters or leading zeroes. Numeric-looking representations are also accepted when letters are unnecessary.
Syntax and signed convention
=HEX2DEC(x)
x is one required hexadecimal representation. There is no optional width, base or unsigned-mode argument. The inspected converter limits hexadecimal text to ten characters and interprets a full-width value with the highest bit set using a signed 40-bit convention.
The decimal result range for valid full-width representations is -549755813888 through 549755813887. Short FF means positive 255, whereas FFFFFFFFFF means -1. Field width and signedness therefore matter when reading machine-style data.
Retained example
=HEX2DEC("FF")
The expected result is 255 because each F represents 15 and 15*16+15=255. The quote marks delimit a text argument; they are not characters in the code itself.
Make a conversion table
Enter the text codes 0F, 10, FF and 00FF in A2:A5. Preformat the cells as text or use the spreadsheet’s text-entry prefix for numeric-looking codes. Put =HEX2DEC(A2) in B2 and fill down.
Outputs are 15, 16, 255 and 255. Leading zeroes do not change the number. The hexadecimal code 10 represents sixteen, not decimal ten. Thus =HEX2DEC(“10”) gives 16, while an ordinary value of 10 elsewhere in the workbook remains decimal ten.
For a reverse check, =DEC2HEX(B2,2) produces a two-character string. The fourth source has four characters, so the inverse with width 2 produces FF rather than preserving its spelling 00FF. Numerical equality does not imply that padding and field identity were retained.
Advanced use: signed fields
=HEX2DEC(“FFFFFFFFFF”) returns -1. Independently, the unsigned pattern is 1099511627775; subtracting 2^40, or 1099511627776, gives -1. =HEX2DEC(“8000000000”) returns -549755813888, the minimum signed value under this convention.
If the source data intended an unsigned field, the signed result may not represent that contract. Do not add 2^40 indiscriminately to every converted value; short positive inputs already have their intended value. Establish the width and representation, then document any adjustment.
Invalid input and troubleshooting
=HEX2DEC(“G”) returns #NUM! because G is not a hexadecimal digit. Overlong strings and unsupported characters can also fail. Validate missing input separately rather than allowing an empty value to become a misleading zero through conversion behavior.
Keep descriptive labels, separators and whitespace outside the code column. The controlled examples use simple digit strings and do not promise acceptance of every programming-language prefix convention. Preserve the raw text when leading zeroes or field width matter.
Choose a numeric output format showing enough digits. A rounded scientific-notation display does not establish that the stored result changed. These controls cover the stated strings and sign boundary, not universal parsing behavior in other applications.
Availability and verification
Version coverage: Gnumeric 1.12.57 has the scoped checks below. The 1.12.62 evidence is a documentation/source check dated October 14, 2026.
- Introduced: Original introduction not established. The earliest demonstrated support in this guide is 1.12.57.
- Availability: Supported in Gnumeric 1.12.62, based on the function-specific registration.
- Scope: Desktop; the fn-eng function module must be included and enabled.
- Checked: October 14, 2026. Documentation/source check; no new native test in Gnumeric 1.12.62.
The executable contract is also present in the official Gnumeric 1.12.57 fn-eng source. The saved source was originally retrieved on October 17, 2026 and re-inspected for this guide. The last functioning release is not established; support in a named version is not a retirement claim.
On October 17, 2026, Gnumeric ssconvert 1.12.57 recalculated a synthetic workbook in the C.UTF-8 locale. Scoped controls: =HEX2DEC("FF") → 255; =HEX2DEC("00FF") → 255; =HEX2DEC("FFFFFFFFFF") → -1; =HEX2DEC("8000000000") → -549755813888; =HEX2DEC("G") → #NUM!. These are native calculation-engine results, not GUI tests or screenshots. Other tutorial layouts and displayed outputs are independent expectations unless covered by these exact formulas. Input/output files, preserved formulas, raw values and hashes were retained. The XLSX importer logged an unused workbookProtection-element warning; changed-input controls and recorded results were checked.