BASE in Google Sheets: Create Padded Binary and Hexadecimal Text
Convert numeric values to base-specific text in Sheets, verify padding and avoid treating binary-looking strings as decimal numbers.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: BASE returns a text representation of a nonnegative integer in a base from 2 through 36. =BASE(26,2,8) has the expected text result 00011010.
Availability and version history
- Introduced: first launch date or introduction version not established by the official history reviewed.
- Availability: documented in the rolling Google Sheets service; this guide uses ordinary cells in the web editor, without a claim about identical mobile authoring workflows.
- Checked: October 14, 2026 against the official BASE reference. Examples were independently calculated; no native Sheets execution was performed.
Syntax, padding and truncation
=BASE(value, base, [min_length])
Value and base are required. The optional minimum length adds leading zeros when the representation would be shorter. It is a minimum, so it does not cut off a longer result. Google documents truncation of noninteger numeric arguments to integers. Official BASE reference
The published description specifies a nonnegative integer input and bases 2–36. It does not give a complete numerical-precision limit or error-code table. This guide does not import Excel’s limits as if they were documented Sheets rules.
Example 1: represent one number four ways
=BASE(26,2)
=BASE(26,8)
=BASE(26,16)
=BASE(26,36)
Expected text results: 11010, 32, 1A, Q. Binary 11010 represents 16+8+2. Octal 32 represents 3×8+2. Hexadecimal 1A represents 16+10. Base 36 uses Q for digit value 26.
Keep the base beside an exported string. A value such as 32 means decimal thirty-two if interpreted in base 10 but represents decimal 26 in base 8.
Example 2: pad controlled binary fields
Enter 0, 2, 26, 64 in A2:A5. In B2 enter and fill down:
=BASE(A2,2,8)
Expected results: 00000000, 00000010, 00011010, 01000000. These particular values fit in eight binary positions.
Now try =BASE(256,2,8). Expected result: 100000000, with nine positions. A minimum length of eight does not validate an eight-bit field. If the destination permits only 0–255, enforce that numeric range separately.
LEN can inspect output width: =LEN(BASE(26,2,8)) is 8. But a width test alone does not decide whether the original input type and value were suitable.
Example 3: observe fractional-argument truncation
=BASE(26.9,16.7,4.8)
Expected result: 001A. In this positive-input example, the numeric arguments become 26, 16 and 4 before conversion. A fractional identifier is not rounded to the next integer.
If the input should be a whole-number sequence, validate it rather than silently accepting truncation. Otherwise several distinct fractional values can become the same displayed identifier.
Advanced example: do arithmetic in the original base-ten quantity
Put 26 in D2, and =BASE(D2,2) in E2. E2 displays 11010. To add three to the quantity and then show the new value in binary:
=BASE(D2+3,2)
Expected result: 11101, representing 29. The source number remains available for arithmetic.
Do not treat a digit-only output string as a decimal quantity. Explicitly applying =VALUE(E2)+3 interprets 11010 as decimal eleven-thousand-ten and returns 11013, which is not binary addition. A base-specific display and an ordinary decimal numeric value need a deliberate conversion boundary.
Google’s BASE help includes a cautionary arithmetic example with inconsistent digits and totals. The controls here are independently calculated rather than copying that faulty sample. Its general warning about silently converting base-specific text remains important.
Advanced example: create a padded hexadecimal label
For a fictional sequence number 291 in G2:
="LOT-"&BASE(G2,16,4)
Expected result: LOT-0123, because 1×16²+2×16+3 = 291. For G2 equal to 4096, the result is LOT-1000.
This is presentation, not encryption or an access-control mechanism. Keep the original numeric sequence rather than trying to reverse every formatted label later. Preserve the output as text during export so leading zeros are not removed by automatic numeric interpretation.
Troubleshooting and limits
The base argument is not a requested decimal-place count. A negative value also does not describe a signed two’s-complement bit pattern in this function’s documented nonnegative-input workflow.
Check a typical value, zero, a padding-width boundary and the limits imposed by the receiving system. Google’s short reference does not establish arbitrary-length numerical accuracy merely because the result is text. Large imported numeric values can lose precision before conversion, and a later text representation cannot reconstruct discarded source digits.
Verification: Expected results use fictional data and independent calculations rather than native Google Sheets observations. See the editorial testing standards.