Contact

HEX2DEC Function in Apple Numbers: Syntax, Examples and Troubleshooting

Engineering Intermediate Apple Numbers

Convert hexadecimal strings to decimal in Apple Numbers, including leading-zero padding and invalid characters.

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

Quick answer: =HEX2DEC("3F") returns 63. Apple also documents =HEX2DEC("F",3) producing 015: the optional argument pads the decimal result, not the hexadecimal input. Official Apple HEX2DEC, checked 2026-10-13.

What it does and exact syntax

=HEX2DEC(hex-string, convert-length)
Argument Required? Type and documented values Default or implication
hex-string Yes Text containing digits 0–9 and hexadecimal letters A–F Interpret as base 16, not decimal. Quote alphanumeric strings such as "3F".
convert-length No Numeric minimum length 1–32 Omitted → 1. If specified and needed, leading zeroes pad the base-10 output.

Hexadecimal digits represent positional powers of 16: A=10, B=11, C=12, D=13, E=14, F=15. Example: 3F means 3×16+15=63. Apple’s input documentation lists uppercase A–F; lowercase acceptance was not independently verified, so use uppercase in reproducible examples. The hexadecimal prefix 0x is not among the allowed characters in the cited specification.

Reproduce the examples in a Numbers table

Create Conversions with one header row. Set B: Hex input to Text and C: Decimal result to a suitable visible output format. Enter the following strings exactly in B2:B7, then enter the corresponding formulas in C2:C7.

Row B: Hex input Formula in C Expected decimal result Check
2 F =HEX2DEC(B2) 15 F=15
3 3F =HEX2DEC(B3) 63 3×16+15; Apple example
4 7B =HEX2DEC(B4) 123 7×16+11
5 FF =HEX2DEC(B5) 255 15×16+15
6 10 =HEX2DEC(B6) 16 1×16+0; not decimal ten
7 A0 =HEX2DEC(B7) 160 10×16+0

All expected results were independently evaluated with base-16 arithmetic, not calculated by Numbers during research. For reproducibility, uppercase text avoids locale or coercion questions about letter handling.

Optional decimal-output padding: a Numbers-specific point

=HEX2DEC("F",3)

Apple’s published result is 015, not F00 or 00F: 15 decimal padded with a leading zero to three characters. The second argument controls the minimum number of displayed decimal characters, rather than hexadecimal output width. Do not confuse the argument with the maximum amount of data that can be converted.

=HEX2DEC("7B",5)

Expected padded result: 00123, derived from the documentation’s rule applied to decimal 123 (a mathematical inference, not a native Numbers test). Before comparing those padded cells with ordinary numbers or exporting them, inspect their stored type and exported characters in your actual Numbers version; the official function example alone does not settle every value-type and import/export behaviour.

Advanced use: decoding configuration bytes

A device may publish option codes as hexadecimal A0. The number is 10×16+0 =160, which corresponds mathematically to the binary representation 10100000. This offers a simple manual audit: the A nibble is binary 1010, and 0 nibble is 0000. To check a decimal mask without accidentally treating A0 as a decimal string, convert it with HEX2DEC first, then interpret bit positions. In a real logging pipeline, document whether your device uses ASCII-hex text, signed quantities or byte arrays before converting.

Numbers has a separate HEX2BIN function if you need a direct hexadecimal-to-binary conversion. Its syntax must be checked separately rather than assumed to behave like HEX2DEC.

Errors, boundary cases, debugging

  • =HEX2DEC("-F",8) is an error in Apple’s official example. A minus sign is not permitted in the hex-input string; do not import Excel signed-hex behaviour into this page.
  • "FG", "0xFF", or punctuation contain characters outside the documented 0–9, A–F set. Clean the imported value before passing it in; no particular error-code name was tested.
  • convert-length less than 1 or greater than 32: outside the stated range. Omitting it assumes 1; setting it to 3 pads short decimal results as above.
  • "10" unexpectedly gives 16: it is hexadecimal 10, not decimal 10. Confirm the source base and source system.
  • Hex strings with leading zeroes: keep the original source in a Text-formatted cell if its width matters. Conversion to the underlying integer does not preserve the source’s hexadecimal encoding width unless separately recorded.
  • Lowercase letters, very large hex strings, negative hexadecimal in two’s complement, and non-integer widths: the checked Apple page does not establish all of those behaviours. Mark such cases native verification required rather than inventing accepted ranges or error codes.
  • Blank/ambiguous source cell: check the source cell’s format (Text versus Number), and identify the table explicitly when the formula and data are in different Numbers tables.

Compatibility: do not conflate Numbers and Excel

Excel’s HEX2DEC(number) has one argument, documents a maximum 10 hexadecimal characters (40 bits) and uses two’s-complement interpretation for certain signed values. These are Excel specifications, not Apple Numbers specifications. Apple’s current page has an optional second output-padding argument and explicitly rejects the literal minus sign in its example. Do not imply a 40-bit Numbers limit or a signed FFFFFFFF.. Numbers result based solely on Excel.

  • Apple DEC2HEX — decimal to hexadecimal, relevant for a conversion workflow; link checked 2026-10-13.
  • Apple HEX2BIN — hexadecimal to binary, distinct from HEX2DEC.
  • Apple BIN2DEC — when the source is base-two instead of base-sixteen.
  • Apple table references — Table::Cell syntax.

Claim-level sources and verification (2026-10-13)

Apple Numbers table references and locale

For the example worksheets, add a table named Conversions with one header row, then place formulas in column C. When the formula is in that same table, a reference such as B2 targets B2 in Conversions. Apple officially documents cross-table references as Table Name::B2 and cross-sheet references as Sheet Name::Table Name::B2; let the Numbers editor build the exact reference for names containing spaces. The examples use the English-language comma separator and quoted text for digit strings. Other locale settings may change how formula arguments are separated. Rather than substituting a separator blindly, insert the function using your Numbers formula editor and confirm its argument prompts. Apple’s documented reference forms and formula editor instructions were checked 2026-10-13.

Compatibility and version evidence

These formulas are documented in Apple’s Formulas and Functions Help 15.4 on 2026-10-13. That establishes their current documented syntax, not the minimum Numbers version in which each function first became available. Apple’s help is a shared reference for iWork formula editing; it does not establish native results for every Mac, iPad, iPhone or iCloud edition. No version-specific performance or behavioural parity test was run for these guides. Formula portability must be checked against each destination program’s documentation and with representative values. Apple’s Numbers for Mac version history records new trigonometry, statistics and logic functions in 15.4; it does not say these three engineering converters first appeared then. Thus we do not assign them a 15.4 introduction date.

Verification and limitations

Documentation-checked, mathematical examples independently calculated, not executed in Apple Numbers. Padded results follow Apple’s published examples. No genuine Numbers screenshots or native error codes are claimed. The catalogue is not a guarantee of support in historical installations.