How to convert an excel workbook to a base64-encoded string
- Step 1Drop your spreadsheet — Upload an
.xlsx,.xls,.ods, or.csvfile. The picker is restricted to those extensions; other types won't appear selectable. - Step 2Let it encode — The tool reads the file's raw bytes with
file.arrayBuffer(), builds a binary string in 32 KB chunks (so large files don't blow the call stack), then encodes withbtoa(). - Step 3Read the header — The first two
//lines report the filename + byte count and the MIME type (file.type, orapplication/octet-streamif the browser couldn't classify it). Note the MIME value if your API needs it. - Step 4Copy the result — The Copy button copies the entire text block — comment lines included. Paste it somewhere editable first.
- Step 5Strip the header for raw use — Delete the two
//lines and the blank separator line. What remains is the pure Base64 string your API field wants. - Step 6Embed in your request — Drop the raw string into your JSON body, e.g.
{ "file": "<base64>" }, and set the content-type field from the MIME line if the API asks for it.
What the output text contains
The tool always emits this four-part shape. Only the last part is the Base64 — the comment lines are for your reference.
| Line | Example content | Keep it for API use? |
|---|---|---|
| Line 1 | // Base64-encoded: report.xlsx (48,213 bytes) | No — strip it |
| Line 2 | // MIME type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | No — but copy the MIME value into your payload |
| Line 3 | (blank separator line) | No — strip it |
| Line 4+ | UEsDBBQABg... (the raw Base64, no data: prefix) | Yes — this is the only part the API needs |
MIME type the tool reports, by uploaded file
The MIME line is whatever the browser reports for the file; the tool falls back to application/octet-stream when the browser returns an empty type.
| Uploaded file | Browser-reported `file.type` | MIME line you will see |
|---|---|---|
| .xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Same — correct for most APIs |
| .xls (legacy) | application/vnd.ms-excel | Same |
| .csv | text/csv | Same |
| .ods | application/vnd.oasis.opendocument.spreadsheet | Same |
| any file the browser can't classify | (empty string) | application/octet-stream (fallback) |
File-size limits by plan (excel family)
Base64 inflates size by about 33%, so a file near your plan's source limit produces a noticeably larger string. Limits are the shared excel-family caps.
| Plan | Max source file | Approx. Base64 output (+33%) | Files per run |
|---|---|---|---|
| Free | 5 MB | ~6.7 MB | 1 |
| Pro | 50 MB | ~66.5 MB | 5 |
| Pro-media | 200 MB | ~266 MB | 20 |
| Developer | 500 MB | ~665 MB | unlimited |
Cookbook
Each recipe shows the tool's literal output and how it maps to a real request. The leading // lines are what the tool prints; the API payload uses only the raw Base64 beneath them.
Encode an .xlsx and embed it in a JSON body
The most common shape: a generic document-processing endpoint that takes the file inline. Strip the comment header, keep the raw string.
Tool output:
// Base64-encoded: report.xlsx (48,213 bytes)
// MIME type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
UEsDBBQABgAIAAAAIQ... (raw Base64, truncated)
Request body (header lines removed):
{
"filename": "report.xlsx",
"contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"file": "UEsDBBQABgAIAAAAIQ..."
}Reuse the printed MIME line for the content-type field
You do not have to remember the long Office MIME string — the second // line is exactly it. Copy that value into whatever the API calls the type field.
// MIME type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
^------------------ copy this into contentType / type / mimeTypeAn .ods (OpenDocument) spreadsheet works too
The picker accepts .ods; the encoder reads its bytes the same way. The MIME line reflects the OpenDocument type.
// Base64-encoded: budget.ods (21,004 bytes) // MIME type: application/vnd.oasis.opendocument.spreadsheet UEsDBBQAAAgAAAAhAA...
Verify the string round-trips with atob() in the console
Quick sanity check before you wire it into code: decode the raw string back and confirm the byte length matches the header's count.
// header said: report.xlsx (48,213 bytes) > atob(b64).length 48213 // matches — encoding is intact
Download for an automation step instead of copying
If a downstream script reads from a file, use Download — the tool writes the full text (comments + Base64) to name.b64.txt. Strip the three header lines in your script if you need raw bytes only.
Download -> report.xlsx.b64.txt # strip the comment header in a pipeline: tail -n +4 report.xlsx.b64.txt > report.b64
Edge cases and what actually happens
File over your plan's size limit
RejectedFree is capped at 5 MB per file. Larger files need Pro (50 MB), Pro-media (200 MB), or Developer (500 MB). The cap is on the source file, not the larger Base64 output.
Comment header copied into the API call
Invalid requestThe Copy button grabs the whole block, including the two // lines. Most JSON parsers and APIs will reject or mis-handle a value that starts with //. Always strip the first three lines for raw use.
Browser can't determine the MIME type
By designfile.type is sometimes an empty string (rare for known spreadsheet extensions). The tool then prints application/octet-stream. Set the correct MIME manually in your payload if the API is strict.
You expected a data: URI prefix
By designThis tool emits raw Base64 only — there is no data:application/...;base64, prefix and no separate prefixed variant. If a target needs a data URI, prepend data:<mime>;base64, yourself using the printed MIME line.
Encoding a .csv file
SupportedCSV is accepted and encoded byte-for-byte; the MIME line reads text/csv. The tool does not parse or reformat the CSV — it encodes the exact bytes on disk.
.xlsm macro workbook
Not selectableThe picker only offers .xlsx, .xls, .ods, .csv. .xlsm is not in the accept list, so you cannot pick it here. To Base64 a non-spreadsheet file, use a generic file-to-Base64 encoder.
Very large Base64 string in the preview
ExpectedStrings over ~10 MB can feel sluggish to render in the text preview. Encoding itself is chunked and fast; if scrolling lags, use Download instead of reading on-screen.
Empty (0-byte) file
PreservedA 0-byte file encodes to an empty Base64 string under the header. The byte count in line 1 reads (0 bytes). Confirm you uploaded a real export.
Need the SHA-256 of the same file
Use sibling toolBase64 is not a checksum. To fingerprint a workbook for integrity, the canonical hashing tool is the multi-hash fingerprinter.
Frequently asked questions
Does my file get uploaded anywhere?
No. Everything runs in your browser — file.arrayBuffer() reads the bytes locally and btoa() encodes them. Nothing is sent to a server.
What's the exact output format?
Two // comment lines (filename + byte count, then MIME type), a blank line, then the raw Base64 string. There is no data: URI prefix.
Why are there comment lines in the output?
They give you the byte count (useful for sanity-checking) and the MIME type (useful for the payload). Delete them before pasting the value into an API field.
Will the Copy button copy only the Base64?
No — it copies the whole text block, including the // header. Paste somewhere editable and remove the first three lines for raw use.
Does Base64 increase file size?
Yes, by about 33%. A 1 MB file becomes roughly 1.33 MB of Base64. Plan your API payload limits accordingly.
Which file types can I encode?
The picker accepts .xlsx, .xls, .ods, and .csv. The bytes of whatever you upload are encoded verbatim.
Can I encode a .xlsm or .pdf here?
Not via this tool's picker — it's filtered to spreadsheet extensions. Use a general file-to-Base64 utility for other types.
Can I decode Base64 back into a file here?
Not yet — decoding is on the roadmap. For now, paste the raw string into any decoder or run atob() in a browser console.
Is the output identical to the `base64` command or a library?
Yes for the Base64 portion. Standard Base64 is deterministic, so the same bytes produce the same string. The only difference is the // header this tool adds.
What's the largest file I can encode?
Free: 5 MB. Pro: 50 MB. Pro-media: 200 MB. Developer: 500 MB. The cap applies to the source file.
The MIME line says application/octet-stream — is that wrong?
It means the browser couldn't classify the file (file.type was empty). For a known .xlsx you'll normally see the Office MIME. Set the right type manually if needed.
What other Excel dev tools pair with this?
For generating typed code from a sheet, see the Python Dict/List Generator, the tRPC Router Builder, and the Tailwind Table Export.
Privacy first
Every JAD Excel tool runs entirely in your browser using SheetJS and ExcelJS. Your spreadsheets, formulas, and data never leave your device — verified by zero outbound network requests during processing.