Contact

BIN2HEX in Apple Numbers: Convert Binary to Hexadecimal with Examples

Engineering Intermediate Apple Numbers

Convert binary bit strings to hexadecimal in Apple Numbers, including output padding, two’s-complement caveats, and error handling.

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: =BIN2HEX("100101") yields 25 hexadecimal, because binary 100101 is 37 in decimal and 37 is 2×16+5. Apple also publishes =BIN2HEX("100111",3) → 027; the optional second argument pads the hexadecimal output, not the source bits. Apple BIN2HEX (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 binary strings to hexadecimal representation. It is useful for inspecting byte flags, sensor fields and compact engineering codes, not for performing logical comparisons. 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:

=BIN2HEX(binary-string, convert-length)
Argument Required? Official value type/default/bounds Practical meaning
binary-string Required Apple calls this a string value of only 0s and 1s; one official example also enters bare digits. A binary value, not a decimal numeric quantity. Enter as text to preserve leading zeros.
convert-length Optional Number, 1–12 inclusive. Omission defaults to 1. Minimum hexadecimal output width; pads the result with leading zeros when it is shorter.

This signature and its range come from Apple’s BIN2HEX 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 100101 =BIN2HEX(B2) 25 0x25 = 2×16 + 5 = 37; binary 100101 = 32+4+1
3 1111 =BIN2HEX(B3) F 15 decimal = F hexadecimal
4 101010 =BIN2HEX(B4) 2A 42 decimal = 2×16+10
5 11111111 =BIN2HEX(B5) FF 255 decimal = 15×16+15
6 0 =BIN2HEX(B6) 0 Zero remains zero
7 100111 =BIN2HEX(B7,3) 027 39 decimal = 27 hex, left-padded to 3 places

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

Binary 100101 can be grouped from the right into four-bit blocks as 0010 0101. The left group has value 2 and the right group value 5, hence hexadecimal 25. For 101010, pad for grouping as 0010 1010, giving 2A. For an eight-bit input 11111111, both four-bit groups are 15 (F), producing FF. These are transparent base-conversion calculations, not an inference from another spreadsheet’s function semantics.

Output length: 100111 represents 39 in decimal, or 27 hexadecimal. Apple documents =BIN2HEX("100111",3) as returning 027. The leading 0 is padding to three output characters. It does not add a new bit to the source string.

Advanced use: audit packed sensor status bytes

Suppose a device exports 10101010 as a binary status byte. The independent binary-to-hex calculation is AA, since both four-bit groups 1010 translate to hexadecimal A. Put the bit string in B8 as Text and use =BIN2HEX(B8) in C8. The output AA is a mathematical expectation, not a native Numbers test. To check each nibble manually, split the original text into 1010 and 1010, sum 8+2=10 for both halves, and map 10 → A in hexadecimal.

Use the hexadecimal representation when copying flags into a technical log or communicating with engineers who specify bytes in base 16. Do not prepend the characters 0x inside the input to BIN2HEX; the Apple binary argument accepts only 0 and 1. If you need a literal 0x display prefix, apply it separately after conversion and verify data type/export conventions in your own file.

Apple’s two’s-complement note needs careful interpretation

Apple says BIN2HEX uses two’s-complement notation and negative numbers are always eight digits long, while also explicitly rejecting a leading minus sign in binary-string. Those statements do not, by themselves, prove that a particular long 0/1 input is treated as negative, or establish an input width limit. This guide avoids inventing a signed-bit test result. Review an actual signed input with native Numbers before documenting such a workflow. See Apple’s BIN2HEX wording.

Errors, limits and troubleshooting

  • -101101: documented error because the minus sign is forbidden; do not prefix binary input with a mathematical negative sign.
  • 100201, 0b1010, spaces, tabs, or alphabetic characters: not permitted by the documented 0/1 rule. Apple’s checked page does not identify a specific error-code label; do not infer one.
  • convert-length of 0 or 13: outside the Apple-documented 1–12 interval. Use a valid number and retest. Decimal fractions for width are not defined on this page; avoid assuming Excel’s truncation behaviour.
  • convert-length shorter than natural hex output: Apple’s argument is a minimum, not a strict fixed width. Do not assume truncation or an Excel-style #NUM! without native testing.
  • Leading zeroes disappear on import: format the source input column as Text; conversion of the numeric value may still work, but its original bit-field width is then lost.
  • A literal 0x prefix is not accepted as binary input; strip prefixes before conversion.
  • Excessively long input: Apple does not state a maximum input bit count on the cited page. Input precision/overflow and signed interpretation remain unverified.

Error-label caution: Apple’s checked BIN2HEX 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 BIN2HEX(number,[places]) with a 10-bit binary input limit and negative results represented as 10 hexadecimal characters. Apple’s 15.4 help instead specifies a 1–12 output-padding argument and says negative results are eight digits; it does not give the same input-width statement. The results and error conditions may therefore differ. Microsoft Excel BIN2HEX (Excel-only evidence); Apple BIN2HEX (Numbers evidence). Do not copy Excel’s signed 1111111111 → FFFFFFFFFF example into an Apple Numbers tutorial as a proven result.

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 BIN2HEX — 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.