FreeMyTools

Base64 Decode in Excel: Formula, Power Query & Decoder

Decode a Base64 cell to text or back to the original file, without a macro.

Runs on your machine · no upload step exists

Keyboard Shortcuts ?
  • Copy Result C
  • Swap Decode / Encode E
  • Toggle This Guide ?
  • Toggle Dark Mode D
  • Focus Primary Input /
  • Clear or Close Esc

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:

File signatures recognised from the decoded bytes
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 PDF
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 size against encoded length and whether it fits a cell
Original Encoded characters One cell?
1 KB1,368Yes
24 KB32,768Just past it
100 KB136,536No
1 MB1,398,104No

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Frequently Asked Questions

Is there a BASE64 function in Excel?

No. Excel has never shipped one, on any version including Microsoft 365. There is no BASE64DECODE, no DECODE, and no worksheet function that reaches the encoder at all. That gap is why every published answer reaches for a macro instead, and it is the reason this page exists.

How do I decode Base64 in Excel without VBA?

Use Power Query. Add a custom column with Text.FromBinary(Binary.FromText([Encoded], BinaryEncoding.Base64), TextEncoding.Utf8) and load it back to the sheet. It is a native Excel feature, it survives a locked-down Trust Center, and the workbook stays a plain .xlsx.

Why does my decoded text have a space between every letter?

Those are not spaces — they are null bytes. The payload was encoded as UTF-16LE, which stores an ASCII character as two bytes with the second one zero, and your decoder read it as single-byte text. Switch the encoding selector above to UTF-16LE and the nulls disappear.

How do I Base64 encode a value in Excel?

Switch this tool to Encode and paste the cell contents, or in Power Query use Binary.ToText(Text.ToBinary([Plain], TextEncoding.Utf8), BinaryEncoding.Base64). Watch the length: encoding grows the payload by roughly a third, so a value that fit comfortably may no longer fit a cell.

Can I get an .xlsx file back from a Base64 string?

Yes, if the string really is a whole file. Paste it above and the tool reads the first few bytes: a PK signature means a zip container, which is what .xlsx, .docx and .pptx all are, and it names the download accordingly. A truncated string decodes but produces a file Excel refuses to open.

Why does Excel truncate my Base64 string?

A cell holds 32,767 characters and no more. Anything longer is silently cut when it is typed, pasted or returned by a formula. A one-megabyte attachment encodes to about 1.37 million characters, so it cannot live in a cell at all — keep it in a Power Query step, or split it across a column.

What is the data:application/pdf;base64, part at the front?

That is a data URI prefix, added when the value came from a web page or an API rather than a raw encoder. It declares the media type and is not part of the payload. The decoder above strips it automatically; if you decode by hand, delete everything up to and including the comma.

Does this handle URL-safe Base64 and missing padding?

Both. URL-safe variants swap plus and slash for hyphen and underscore, which standard decoders reject; these are translated back before decoding. Trailing equals signs are also restored when a system that considers them optional has stripped them.

Is the data I paste here sent to a server?

No. The decoding runs in JavaScript on your own machine and there is no upload step in the page at all — you can watch the network tab stay empty. That matters because Base64 blobs in a spreadsheet are usually attachments, signatures or exported records that should not be handed to a stranger's server.