NUMTOBASE in Apple Numbers: Convert Decimal to Binary, Hex and Base 36
Convert decimals to base 2–36 with NUMTOBASE in Apple Numbers, including width defaults, leading zeroes, negative value notes and reproducible examples.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Apple Numbers. How formula examples are checked
Verification (13 October 2026): Official Apple documentation and independent exact-integer arithmetic were reviewed. No native Numbers application execution or export/screenshot test was performed.
Quick answer: what NUMTOBASE does
Express a base-10 number in a specified output base. The third argument controls the minimum length of the resulting representation, which matters for padded codes.
One-line example: =NUMTOBASE(100,2) → 1100100 (Apple-documented or independently checked expected display). Official Apple NUMTOBASE function reference (checked 2026-10-13).
Exact Apple Numbers syntax and argument order
=NUMTOBASE(decimal-string, base, convert-length)
decimal-string — required, Apple calls it a string value: The article describes decimal digits 0–9. It also explicitly documents =NUMTOBASE(-16,16) returning -10, although a minus sign is not a digit; report this as a documentation inconsistency rather than assuming the negative example never works. Numeric literal inputs are shown in Apple’s own examples. NUMTOBASE.
base — required, numeric output base: Apple lists 1–36. Here the positional worked examples use 2–36, with base 1 left unverified because the official help does not explain unary representation.
convert-length — optional, number: Allowed 1–32 inclusive; default 1. Specifies the smallest number of characters, padding with leading zeros. It does not truncate a longer conversion. Note the 1–32 range differs from 1–16 for BIN2OCT/HEX2OCT; don’t transfer width limits between functions. NUMTOBASE.
Formula punctuation and locale: These examples follow Apple’s English function reference, with commas separating arguments. In localized Numbers editions, translated function identifiers and semicolons may apply. For example, Apple’s Portuguese-Brazil article calls BIN2OCT BINPARAOCT and shows semicolons; this is a locale display. Use the function browser in the target Numbers locale rather than mechanically swapping separators. Apple’s localized BIN2OCT help; Apple argument types (checked 2026-10-13).
Step-by-step worksheet: copy the inputs and formulas
- Create a new spreadsheet in Numbers and add a table called Conversions. This guide assumes no special add-ons, scripts or API access.
- Type the headers shown below into row 1. Set imported code columns to Text before entering strings such as
00101,F, or3F; otherwise a conversion may silently change the source representation. - Enter source examples and formulas in the indicated rows. Each formula references cells in the same table; direct formulas use ordinary
A2,B2,C2syntax. Other tables or sheets need table-qualified references described in Apple’s official cell-reference guide. - Read the last column as the expected output, not a native-test report. For padded output keep an output column that preserves the displayed leading zeroes; evaluate actual formatting in Numbers before exporting a production file.
| A: decimal source | B: target base | C: width | Formula | Expected display | Evidence |
|---|---|---|---|---|---|
| 16 | 16 | 1 | =NUMTOBASE(A2,B2) |
10 |
Apple published, no explicit width |
| 100 | 32 | 4 | =NUMTOBASE(A3,B3,C3) |
0034 |
Apple-published four-character base-32 representation |
| 100 | 2 | 1 | =NUMTOBASE(A4,B4) |
1100100 |
Apple-published binary conversion |
| 255 | 16 | 1 | =NUMTOBASE(A5,B5) |
FF |
Independent positional math; uppercase formatting to verify natively |
| 63 | 8 | 1 | =NUMTOBASE(A6,B6) |
77 |
Independent positional arithmetic |
| 64 | 2 | 8 | =NUMTOBASE(A7,B7,C7) |
01000000 |
Independent arithmetic plus minimum width |
Testing distinction: A mathematical base conversion explains the expected numerical value; it does not prove that a particular Apple Numbers locale treats every source cell as text, preserves padding in an export or accepts values beyond documented limits. Apple’s argument types (checked 2026-10-13).
Formula examples explained, including the arithmetic
Example 1. =NUMTOBASE(16,16) → 10. Hexadecimal ten: 1×16 + 0 = decimal 16.
Example 2. =NUMTOBASE(100,32,4) → 0034. Base-32 34 = 3×32 + 4; width four adds two zeros.
Example 3. =NUMTOBASE(100,2) → 1100100. Binary bits 64+32+4 = 100.
Example 4. =NUMTOBASE(-16,16) → -10. This negative case is printed by Apple despite its digits-only argument wording.
Advanced uses and independent cross-checks
Create fixed-width binary display codes
Put decimal 64 in A2, target base 2 in B2 and required minimum width 8 in C2. =NUMTOBASE(A2,B2,C2) has expected output 01000000. This encodes the same number and adds one leading zero. For a number needing nine bits, a width of eight does not truncate the ninth bit.
Publish hexadecimal values from decimal measurements
Hexadecimal is convenient for documentation of device addresses and debug codes. Decimal 255 mathematically maps to hexadecimal FF (15×16 + 15); a =NUMTOBASE(255,16) result should represent those digits. The exact letter-case presentation in a real Apple Numbers cell was not executed here. If your downstream protocol requires uppercase ASCII or fixed-width text, inspect an exported sample before deployment.
Pair with BASETONUM for a round-trip proof
A positive value may be transformed with =NUMTOBASE(100,32,4) (documented display 0034) and decoded using =BASETONUM("0034",32) (mathematical expected 100). The latter result is a numeric value, so leading zeros are no longer a meaningful property. The pair is a conceptual cross-check, not proof that every large integer or negative case survives a real-world import/export.
Compare positive and negative signed representations
Apple’s help explicitly gives =NUMTOBASE(-16,16) → -10. Its two’s-complement-specific BIN2OCT/HEX2OCT articles instead discuss fixed-width negative octal output and reject literal minus inputs. Therefore these functions must not be documented as if their negative conventions were identical.
Edge cases, errors and troubleshooting
| Input or symptom | Why it fails or surprises | Corrective action |
|---|---|---|
=NUMTOBASE(16,37) |
Target base 37 exceeds Apple’s documented 36. | Choose a target base in the permitted interval. |
=NUMTOBASE(16,16,0) |
Requested width must be 1–32. | Omit width or use 1–32. |
=NUMTOBASE(16,16,33) |
Width 33 is out of range. | Reduce minimum width to 32 or lower. |
Unexpected 10 instead of 0010 |
A minimum width was not requested. | Use =NUMTOBASE(16,16,4) for mathematical expected 0010. |
| Negative source unexpectedly fails after data import | Source parsed as text or locale-specific sign handling differs. | Verify the original cell type; native-check Apple’s published -16 example before relying on it. |
Error-code limitation: Apple’s function article documents some inputs as “returns an error” without prescribing a stable literal error label. The table above intentionally says error rather than inventing a specific #VALUE!, #NUM! or implementation-specific diagnostic. If your locale reports something different, inspect Apple’s formula-error guidance and verify the source data type (checked 2026-10-13).
Negative numbers, bounds and implementation limitations
Important Apple documentation tension: the decimal-string description states that the value must contain decimal digits 0–9, yet the very same reference demonstrates -16 → -10. Both facts are recorded. The article doesn’t establish behavior for a quoted negative text string versus a negative numeric cell, fractional inputs, precision limits for large integers, or the special base-1 case. Those scenarios remain open native-test questions, not grounds to import rules from Excel or LibreOffice.
Copying formulas across sheets
If the original sample cells are stored in Table 2 instead of the same table, a reference can be written using Apple’s documented form Table 2::A2. To refer to a different sheet, a qualified example is Sheet 2::Table 2::A2. Do not assume Excel-style Sheet!A2 notation works in Numbers; use the application’s reference picker and the Apple reference instructions.
NUMTOBASE compared with related conversion functions
NUMTOBASE accepts a decimal source and an output base. BASETONUM accepts an encoded source plus its input base and yields a decimal number. DEC2BIN, DEC2HEX and DEC2OCT specialize the output bases and have their own limits and signed-value notes. For example =NUMTOBASE(16,16) represents 16 decimal as hex 10; =BASETONUM("10",16) interprets hex 10 as decimal 16. Apple NUMTOBASE; Apple BASETONUM.
Application, release and platform compatibility: what is established
This function is present in the current official Apple Formulas and Functions Help, documentation edition 15.4, in the Engineering category. The general help is used with Numbers and related Apple productivity applications. Documentation edition 15.4 is not evidence that the function was introduced in Numbers app version 15.4, nor proof it behaves identically in all older macOS/iOS/iPadOS/iCloud releases. Official help; Numbers for Mac release notes (reviewed 2026-10-13).
Apple’s documented English syntax and example results are the evidence for these claims. This guide does not establish parity with Microsoft Excel, Google Sheets, LibreOffice, or browser-based spreadsheet tools: those products have independent error codes, limits, coercion rules, localization and negative-number encodings. Their behavior is not used as Apple Numbers evidence.
Precision and display policy
Base conversion is exact arithmetic only while the input can be represented and parsed accurately. The official individual function documentation does not specify a universal maximum exact integer magnitude, rounding or overflow policy for all possible inputs, so this guide deliberately avoids such thresholds. Treat long codes or signed values as data requiring native app checks. A width parameter adds zeros for presentation; it does not increase information in the underlying number.
Quick questions
Does this formula need an extension, macro or paid service? No. It is documented by Apple as a built-in spreadsheet function. No external API is required for the examples here.
Can I use a cell reference instead of typing an argument? Yes; the reproducible worksheet uses A2 and, where relevant, B2/C2. Refer to Apple’s Numbers-specific table scope syntax when using another table or sheet.
Are the displayed results verified in the Apple Numbers app? No. Apple-published examples were documentation-checked, and positive-number examples were independently computed. Native execution and formatting/export screenshots were not performed.
Official sources, checked 2026-10-13 (UTC)
- Apple official reference — Exact syntax, base 1–36, width 1–32/default, zero-pad and four Apple-published examples including negative.
- Apple official reference — Reverse generic conversion and numeric return type.
- Apple official reference — Types of values in functions.
- Apple official reference — Cell, table and sheet references.
- Apple formula-error troubleshooting — diagnosing invalid formulas and references.
- Numbers for Mac release documentation — release context only; not a function-specific introduction date. Method: Manual comparison of Apple’s official help with independent Python exact-integer base arithmetic for positive examples, on 2026-10-13 UTC. Zero native Numbers execution. Unresolved native-behavior questions are identified explicitly in this guide.