LocalExcelTool
Get started

File to Base64

Encode any file into a Base64 data URL text.

What is File to Base64

The File to Base64 tool converts any file — fonts, JSON, PDF, whatever — into a data URL text. It reports the file name, size, MIME type and Base64 length, then prints the full data URL ready to paste into HTML or CSS. Runs in your browser; the file never leaves your device (4 MB limit). For images only, the Image ↔ Base64 tool adds a preview.

🔒 Everything runs in your browser. Nothing is uploaded.

What this tool actually does with your file

Where it runs
In your browser, on this page
Upload
None — the file never leaves your device
Offline
Works with the network disconnected

Any file, as text, locally

The file is read into an ArrayBuffer and encoded to Base64 in the page — useful for APIs that accept attachments only as a JSON string, for embedding a small binary in a config file, and for pasting a payload into an environment where file upload is blocked.

Encoding happens on the raw bytes, so the result is exact and lossless: decoding returns the identical file, verified by its original checksum. There is no interpretation of the content and therefore no charset problem, unlike text-oriented tools.

The 33% tax and where it stops you

Base64 grows the payload by roughly a third, and API gateways usually cap request bodies well below the file sizes people expect to send. A 10 MB PDF becomes about 13.4 MB of JSON, which then exceeds a 10 MB limit — so the failure appears at the transport layer, far from the encoding decision.

Memory is the second ceiling. The browser holds the file, the byte array and the encoded string at once, so peak usage is roughly three times the file size. Large files will stall or kill the tab well before any server limit is reached.

Decoding back to a file

A decoded payload must be written to a Blob with the correct MIME type and saved with the right extension; writing the text to a .txt file produces a file that cannot be opened. If the tool offers a download, check that the first bytes match the format you expect.

Watch for line wrapping and truncation on the way in. Base64 embedded in an email or copied out of a log often arrives broken at 76 characters with CRLF, or cut at a length limit with no error. A decoder that ignores whitespace handles the first; nothing recovers the second, which is why the decoded size should be compared with what the sender announced.

How to use

  1. 1.Choose a file
  2. 2.Run to generate the data URL
  3. 3.Copy the output into your HTML/CSS

How this compares

There are three ways to do this conversion: in the browser (this page), through a server-side converter, or with a desktop app. The useful difference is not speed — it is where your file goes and how far the free tier actually reaches.

AspectThis toolUpload-based converters
Where the file is processedIn your browser, on this pageOn the vendor's servers, after an upload
Account requiredNoUsually — free tiers ask you to sign in before lifting a limit
Size you can process for freeNo size cap, no run limitA few files per hour, or a ~5–10 MB cap before a paywall
PriceFree. Pro is $9/month, and only buys larger files and AI featuresUsually a subscription — roughly $7–15/month as of November 2026
Works offlineYes, once the page has loadedNo
Time before work starts on a 20 MB fileImmediate — there is nothing to uploadDominated by the upload — about 16 s on a 10 Mbps uplink
What it cannot preserveOutput is deterministic — verify it against any other implementationThe same — the conversion is the same maths

Server-side converters are genuinely better at some things: very large files, sharing results with a team, keeping a conversion history, and automating batches from a script. For the case in front of you — one file, one format change, right now — they mostly add an upload wait and a sign-up form.

Frequently asked questions

Does it work with any file?

Yes. For images the Image ↔ Base64 tool is more convenient (it previews), but this one handles fonts, JSON, PDFs and anything else.

What is the size limit?

4 MB. Note the Base64 text is about 1.33× the original file size.

What this kind of conversion cannot keep

Encoding and hashing run through the browser's Web Crypto API or a pure-JavaScript implementation. The output is deterministic: the same input always produces the same digest, so you can verify a result against any other tool.

More in Encoding