Why Excel Has No BASE64 Function
Search for a Base64 decode in Excel formula and you will find dozens of answers, none of
which is a formula. That is not laziness on anyone’s part: the encoder simply is not
exposed to the worksheet. There is no BASE64DECODE, no hidden equivalent, and
no combination of MID, CODE and CHAR that reproduces
it at a sane length. Microsoft 365 has not added one either.
So the community settled on a macro. The usual one borrows the XML parser —
MSXML2.DOMDocument with a node typed bin.base64 — and it
works perfectly on a machine where you are allowed to run it. That last clause is the
problem, and it is the reason this page leads with a decoder you can use right now rather
than a snippet you have to install.
The Power Query Route, Which IT Cannot Switch Off
Excel can Base64 decode without VBA, and the route is Power Query. It ships in every
desktop build since 2016, it is not a macro, and a workbook that uses it stays an ordinary
.xlsx. Binary.FromText is the Power Query function that turns the
encoded string into bytes; Text.FromBinary turns those bytes into readable
characters.
Select your column, then Add Column → Custom Column:
= Text.FromBinary(
Binary.FromText([Encoded], BinaryEncoding.Base64),
TextEncoding.Utf8
) Going the other way, to decode Base64 in Power Query is only half the story — the encode direction is:
= Binary.ToText(
Text.ToBinary([Plain], TextEncoding.Utf8),
BinaryEncoding.Base64
)
Two details catch people. The third argument to Text.FromBinary is optional,
and when you omit it Power Query guesses — sometimes correctly, sometimes not, and it
will not tell you which. And TextEncoding.Unicode in M means UTF-16LE, not
“whatever Unicode you had in mind”.
What the Macro Answer Actually Costs
The VBA snippet is not wrong. It is unavailable, which in practice is worse, because you only discover that after saving the workbook, mailing it, and hearing that it does nothing on the recipient’s machine. Three separate mechanisms have to line up before a macro runs at all:
- Trust Center policy. Most managed tenants set macros to disabled without notification. There is no prompt, no yellow bar, and no error — the code is simply skipped.
- Mark of the Web. Since 2022, files that arrived from the internet or an email attachment have macros blocked outright, and the setting cannot be overridden from inside Excel.
- File format. The workbook has to become
.xlsm. Plenty of document management systems and finance portals reject that extension on upload.
Add the fact that a macro is stored per workbook, and the answer to “how do I decode this column” becomes a small deployment project. A Power Query step or the tool at the top of this page has none of that weight.
Getting a File Back Out of a Blob
A good share of the demand here is not really about text. Someone has been sent a JSON payload, or has pulled a row out of a database, and the field holds an entire document. Searching for a base64 decode to Excel file online is exactly that job: they want the workbook back, not a screenful of mojibake.
The first few bytes identify the format, so the decoder above reads them and names the download for you:
| First bytes | Base64 begins | Format |
|---|---|---|
| 50 4B 03 04 | UEsDB | Zip container — .xlsx, .docx, .pptx |
| D0 CF 11 E0 | 0M8R4 | Legacy OLE2 — .xls, .doc, .msg |
| 25 50 44 46 | JVBER | |
| FF D8 FF | /9j/ | JPEG |
| 89 50 4E 47 | iVBOR | PNG |
The middle column is worth memorising if you deal with these often — you can tell what
a blob holds from the first five characters without decoding anything. A string starting
UEsDB is a zip, and if it came from a spreadsheet system it is almost certainly
an .xlsx.
When the Decoded Text Comes Out Wrong
Base64 carries bytes. It records nothing about how to read them back into letters, so the decoder has to guess, and a wrong guess is the single most common complaint about every converter in this space.
Every other character is blank
Those blanks are null bytes. Windows components, .NET string fields and anything that went
through StrConv hand you UTF-16LE, where an ASCII letter occupies two bytes and
the high one is zero. Set the selector to Base64 decode with UTF-16LE and the text
straightens out immediately. This is the encoding Excel itself uses internally, which is why
it turns up so often in spreadsheet workflows.
Accented letters became question marks or two-character pairs
An é arriving as é means UTF-8 bytes were read
as single-byte Windows-1252. The reverse, a lone �, means genuine
Windows-1252 bytes were read as UTF-8 and failed. The selector fixes both; the automatic
detection tries strict UTF-8 first and falls back to Windows-1252 only when that fails.
A leading invisible character
A byte-order mark decodes to U+FEFF, which is invisible on screen and breaks
VLOOKUP matches in the most infuriating way possible. It is stripped here
automatically. If you decode elsewhere, wrap the result in CLEAN or compare
lengths to catch it.
The Cell Length Ceiling
The Excel cell character limit is 32,767, and it is a hard stop rather than a display convenience. Base64 grows a payload by four bytes for every three, so:
| Original | Encoded characters | One cell? |
|---|---|---|
| 1 KB | 1,368 | Yes |
| 24 KB | 32,768 | Just past it |
| 100 KB | 136,536 | No |
| 1 MB | 1,398,104 | No |
Roughly 24 KB of original data is the practical ceiling for one cell. Above that, keep the value inside a Power Query step, where no such limit applies until you load to a sheet, or handle the file outside Excel entirely. There is a second, softer limit worth knowing: the formula bar only ever shows 8,192 characters, so a cell can look truncated while holding far more than that.
If the value has already arrived split across a column — which is how most systems
export something oversized — reassemble it before decoding with
=TEXTJOIN("",TRUE,A1:A40). That formula carries the same ceiling on its own
result, so it only helps when the whole payload fits once joined. Beyond that, the join has
to happen somewhere the limit does not apply: a query step, or outside the workbook
altogether. For a one-off, paste the fragments into the box above in order — the line
breaks between them are discarded before decoding, so no joining formula is needed at all.
Cleaning a Value That Came Out of a Cell
Base64 that has been through a spreadsheet is rarely pristine. Four kinds of damage account for nearly all failed decodes, and all four are repaired automatically above:
- Line breaks. MIME wraps at 76 characters, and pasting into a cell keeps them. Whitespace is not part of the alphabet, so strict decoders reject it.
- A data URI prefix. Values copied from a browser carry
data:application/pdf;base64,or similar. Everything up to the comma is metadata, not payload. - URL-safe characters. Tokens and API responses use hyphen and underscore in place of plus and slash, so a standard decoder sees an illegal character.
- Missing padding. Some systems drop the trailing equals signs as redundant. The length then fails the multiple-of-four check and decoding stops.
If the tool still reports invalid input after all that, the string is genuinely incomplete — usually because it was longer than a cell and Excel truncated it on the way in.