Contact

HEX2BIN in Apple Numbers: Hexadecimal to Binary Formulas

Engineering Intermediate Apple Numbers

Convert hexadecimal strings to binary in Numbers, choose minimum output width, read individual bit flags, and troubleshoot invalid inputs.

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: =HEX2BIN("3F") returns 111111; hexadecimal 3F means 3×16+15=63, or binary 32+16+8+4+2+1. Use =HEX2BIN("F",8) for Apple’s documented eight-character 00001111 output. The second argument sets minimum binary output length, not the number of source hex digits. Apple HEX2BIN (checked 2026-10-13).

Verification: Apple documentation and independent arithmetic were checked. Expected results were not produced by running Numbers; official examples are identified separately. No native application execution or screenshots were performed.

What the function does—and what it does not

Convert a base-16 string into a base-2 representation, optionally padded with leading zeroes for a fixed-width bit field. A positional numeral conversion changes how a quantity is written, not its magnitude: binary uses powers of 2, decimal powers of 10, and hexadecimal powers of 16.

Exact Apple-documented argument order:

=HEX2BIN(hex-string, convert-length)
Argument Required? Official value type/default/bounds Practical meaning
hex-string Required Apple defines a string containing only 0–9 and A–F. Hexadecimal value; no documented prefix such as 0x. Case-insensitive handling of lower-case letters is not established by the checked source.
convert-length Optional Number, 1–32 inclusive; omission defaults to 1. Minimum binary output width; prefix zeroes when the result is shorter.

This signature and its range come from Apple’s HEX2BIN reference (edition 15.4, checked 2026-10-13). In Apple’s English-language examples the arguments are separated with a comma; use the function editor to check the correct separator for your document’s locale before pasting a formula from another region. No argument may be silently swapped with another conversion function’s parameter order.

Reproduce the formulas in a Numbers table

Create a table named Conversions. Set column A’s header to Meaning, B’s header to Input, and C’s header to Result. Enter the following inputs in B2:B7. Set input cells to Text for hex/binary identifiers and for any value where leading zeroes matter. Put the corresponding formula in C2:C7. The examples assume the formula and the referenced cells belong to the same table, so ordinary B2 syntax applies. For references across tables or sheets, use the names generated by Numbers’ reference picker rather than blindly copying an Excel Sheet!B2 formula; see Apple’s reference guidance.

Row B input Formula in C Expected visible result Manual audit
2 F =HEX2BIN(B2,8) 00001111 F = 15 decimal = 1111 binary; minimum width 8
3 3F =HEX2BIN(B3) 111111 3×16 + 15 = 63 = 111111 binary
4 A =HEX2BIN(B4) 1010 A = 10 = 8+2
5 2A =HEX2BIN(B5) 101010 2×16 + 10 = 42 = 32+8+2
6 7F =HEX2BIN(B6) 1111111 7×16 + 15 = 127
7 0 =HEX2BIN(B7) 0 Zero stays zero

Evidence boundary: If a formula is also one of Apple’s literal examples, the source is identified in this guide. Otherwise the displayed result is an independently calculated expectation, not a screenshot or an execution log. To test on your own Mac, enter the exact inputs, use the formula editor, and compare cell C to the expected result without changing source formatting.

Understanding the conversion step by step

Hexadecimal 3F equals 3×16+15 = 63 decimal. 63 is 32+16+8+4+2+1, so the binary representation is 111111. Hexadecimal 2A is 2×16+10 = 42, hence binary 101010. A full hexadecimal digit corresponds to a group of four binary bits: F = 1111, A = 1010, 7 = 0111.

Output width: Apple explicitly documents =HEX2BIN("F",8) → 00001111. The eight positions are an output display requirement; do not confuse them with the number of hex digits in the input.

Advanced use: decode hexadecimal status bytes

A controller returns the hexadecimal status byte AB. In base 16, A=10 and B=11; thus AB equals 10×16+11 = 171 decimal. Translate each hexadecimal digit into four binary bits: A → 1010, B → 1011. Combining the pairs gives 10101011, the expected result for =HEX2BIN("AB",8). This is an independent base conversion, not a native Numbers result.

Use the binary output to inspect individual flags: count from the right (bit 0 is the rightmost). In 10101011, bits 7, 5, 3, 1 and 0 are 1, so their decimal contributions are 128+32+8+2+1 = 171. To interpret a status mask by integer operations rather than display conversion, Apple’s BITAND can be used separately, with its own documented rules; the bitwise result should not be conflated with the text representation returned by HEX2BIN.

Do not confuse input width with output width: a two-character hex byte normally expands to up to eight bits. convert-length=8 preserves an 8-position representation for a positive byte-like input, while the documentation’s wording is a minimum and says nothing about input byte validity/size beyond the hex character constraint. Round-trip a critical operational log in Numbers before relying on it.

Errors, limits and troubleshooting

  • "-F": Apple explicitly documents an error, because a minus sign is not permitted in a hex string.
  • "0x3F" and "3G": x and G violate Apple’s documented 0–9/A–F character rule. Remove any 0x prefix before calling this function.
  • A convert-length of 0 or 33 is outside Apple’s 1–32 bounds; no assumed error-code label is provided.
  • Lowercase input such as "ff" is not covered by the checked Apple help’s explicit A–F wording. Normalize to uppercase in your source or natively test rather than assuming acceptance.
  • More than the requested width: Apple says minimum length. A long result should not be assumed to truncate or throw an Excel-specific error.
  • Losing zeros: enter hex identifiers as Text; if a source file loses a 00 prefix, the converted value may remain mathematically correct while the identifier format is corrupted.
  • Hex values that cannot be represented within software precision/limits: the Apple source does not establish a maximum input count or signed interpretation for HEX2BIN. Do not invent a Numbers bound from Excel’s documentation.

Error-label caution: Apple’s checked HEX2BIN page states some invalid-input conditions but does not establish a complete mapping of all faults to displayed error names. This guide deliberately distinguishes a documented invalid case from a native test result, which has not been obtained.

Apple Numbers versus Excel: use source-specific rules

Microsoft documents Excel’s HEX2BIN(number,[places]) with distinct limits: a positive hex input cannot exceed 1FF, signed values have an Excel-specific 10-character interpretation, and Excel uses its own #NUM! failure rules. Apple’s documented convert-length is 1–32, and its cited HEX2BIN article does not give those same Excel input limits. Use Apple documentation for Numbers and validate cross-app workbooks with actual examples. Microsoft Excel HEX2BIN (Excel only); Apple HEX2BIN (Numbers).

A formula that appears identical in both products can still accept a different numeric range, padding parameter and signed representation. Test critical imported workbooks in their destination app before relying on conversion output.

Version and platform guidance

The formula signature and examples here are verified from Apple Formulas and Functions Help, version 15.4, checked 2026-10-13. Apple’s Mac version history lists Numbers 15.4 and says Numbers 15.4 for Mac requires macOS 26 or later. That release note does not establish when this particular engineering function first shipped. No native execution was performed on Numbers for Mac, iPad or iPhone; availability in older versions, behavior after importing from Excel, exact error-label localization, and output data types in exported files remain unverified. Follow the in-app function browser for your installed version rather than assuming the same signature applies to all editions.

For localized function entry, the formulas above use English function names and commas as Apple presents them in its English Help. Decimal separator, argument separator and display formatting can differ with document language/region; confirm formula tokens in the function editor. Do not mistake commas inside quoted text for separators.

Official sources and validation

  • [A1] Apple HEX2BIN — official syntax, input types, width/default rules, examples and any explicit signed note; checked 2026-10-13; Apple Formulas and Functions Help 15.4.
  • [A2] Apple cell references — reference syntax and table-scoped formula workflow; checked 2026-10-13.
  • [A3] Apple Numbers Mac version history — 15.4 release summary and macOS requirement; checked 2026-10-13.
  • [M1] Independent base-conversion audit using Python integer arithmetic (base 2/10/16), with expected results recorded by formula in the evidence JSON; calculations are not native Numbers formula execution.
  • [C1] Microsoft Excel function reference linked above: compatibility comparison only. Its limits, errors, and negative encoding are not evidence about Numbers.

Limitations: Native Numbers execution, localized entry, signed/overflow boundaries and exported value types were not tested. Validate critical workflows in the target app.