Free online file to Base64 encoder
File to Base64 without freezing the tab
Drop any file up to 5 MB and get its Base64 — free, no account, and no upload, because the bytes are read and encoded inside this tab. The file goes through in 768 KB slices with a pause between each one, so a 5 MB archive encodes in about 110 milliseconds without the page ever stopping to paint, and the progress bar counts real slices rather than pretending. The media type is settled from the first bytes rather than from the extension, which is how a .docx is identified as a Word document instead of a ZIP, and the page finishes by telling you whether a data: URI is a good idea at this size — including whether the string would even fit in a cookie or a URL.
- 100% free
- No signup
- 5 MB per file
- Any file type
- Read in 768 KB slices
Drop a file anywhere in this panel, paste one from the clipboard, or pick one.
Documents, archives, fonts, audio, executables — anything up to 5 MB. The file is read in 768.0 KB slices with a pause between them, so the page keeps responding while it works.
How to convert a file to Base64
Hand it over, watch the slices, read the verdict.
Hand over the file
Drop it on the panel, press ⌘V or Ctrl+V to take one off the clipboard, or use Choose file. Type does not matter — a .docx, a .woff2, a .sqlite database, a firmware image and a signed .p7s all encode the same way, because the encoder reads bytes and asks no questions about them.
Watch it go through in slices
The progress bar counts real work, not a spinner: each 768 KB slice is read and encoded on its own, and the loop hands control back to the browser between slices so scrolling, typing and the rest of the page keep working. When it finishes, the panel reports how many milliseconds it took and how many slices there were.
Read the verdict before you paste it anywhere
Alongside the string you get the media type and where it was decided, plus a straight answer on whether inlining is sensible at this size and four specific checks — will it fit in a cookie, will it fit in a URL, will it survive an HTML email, will it open from the address bar. Copy takes the whole string; Download writes it to a .base64.txt file next to the original name.
Technical specifications
| Accepted input | Any file type, from any source — documents, archives, fonts, audio, disk images, certificates. Nothing is rejected on extension |
|---|---|
| Maximum file | 5 MB (5,242,880 bytes), producing 6,990,508 Base64 characters and about 13.3 MB of UTF-16 string in memory |
| Reading strategy | Blob.slice at 786,432 bytes — 768 KB, a multiple of 3 so each slice encodes independently — with a yield to the event loop between slices; a 5 MB file goes through in 7 slices |
| Measured throughput | About 110 ms for 5 MB and 26 ms for 1 MB on an M-series laptop, timed by the page and reported with the result |
| Media type sources | The leading 4 KB first, then File.type, then the extension, then application/octet-stream; ZIP payloads are opened far enough to tell .docx, .xlsx, .pptx and .epub apart |
| Signatures recognised | 24 magic numbers including PDF, PNG, JPEG, GIF, WebP, AVIF, ICO, gzip, ZIP, RAR, 7z, WOFF, WOFF2, TTF, OTF, MP3, MP4, Ogg, FLAC, WebM, RTF and WebAssembly |
| Output | Raw Base64 or a data: URI with the resolved type. Only 40,000 characters are drawn on screen; both Copy and Download hand over every character, and Download names the file <original>.base64.txt |
| Price and processing | Free, no account, no per-day limit; every byte is read and encoded inside this tab and none is uploaded |
Frequently asked questions
Why does the browser report the wrong type for my file?
Because File.type is not read from the file — it is looked up from the extension in the operating system's registry, and that registry can be empty, stale or hijacked. Chrome commonly reports nothing at all for .svg, .md, .yaml and .toml; Windows reports text/csv as application/vnd.ms-excel once Excel claims the extension; and a file renamed from .jpg to .png is reported as a PNG that no decoder will accept. This page reads the first 4 KB and matches it against known signatures, so the bytes settle any argument, and it tells you when there was one.
Does a big file lock up the page while it encodes?
Not here, because the work is split. Reading a 5 MB file into one buffer and encoding it in a single pass blocks the main thread for the whole duration, and the tab stops painting — no scroll, no cursor, no progress. This page slices the file at 768 KB, encodes one slice, yields to the event loop, then takes the next, so the longest uninterrupted block of work is a fraction of the total. The slice size is a multiple of 3 on purpose: Base64 works in 3-byte groups, and cutting anywhere else would give each half its own padding and produce a string that decodes to rubbish.
When is a data: URI the wrong answer?
Whenever the payload is large, changes often, or has to cross a boundary that limits length. Past about 30 KB inlining costs more than the request it saves, and the panel says so outright. A cookie is capped at 4,096 bytes by RFC 6265, so anything bigger simply will not be stored. A URL runs into nginx's 8 KB buffer for the request line and headers and comes back as a 414. HTML email is worse than either — Outlook on Windows and Gmail on the web both strip data: image sources, so an inlined logo arrives as an empty box.
Will the Base64 fit in a cookie or a query string?
The page works it out for your actual file and tells you. RFC 6265 §6.1 only requires a browser to support 4,096 bytes per cookie including the name, so the practical ceiling for a Base64 value is around 4 KB — about 3 KB of original file. For a URL the binding limit is usually the server rather than the browser: nginx allows 8 KB for the request line and all headers together by default, and exceeding it returns 414 or 400 rather than a useful error. Both checks appear under the output with a yes or no.
Is a .docx really a ZIP file?
Yes, and this page will say so. Every Office Open XML document — .docx, .xlsx, .pptx — is a ZIP archive whose first four bytes are 50 4B 03 04, with the real content in XML files inside it. So is an .epub, and so is a .jar. Signature matching alone would call all of them archives, so the encoder looks a little further and reads the first member names: a word/ directory makes it a Word document, xl/ an Excel workbook, META-INF/container.xml an EPUB. That is the same trick the file command uses, and it is why the media type here is more specific than application/zip.
Why is the string twice its own length in memory?
Because a JavaScript string is UTF-16, two bytes per character, whatever those characters are. Base64 is pure ASCII, so every character costs a byte it does not need: a 5 MB file becomes 6,990,508 characters, and holding those characters costs about 13.3 MB of memory while the original bytes are still around too. That is the real reason a browser-based encoder has a size ceiling — not the arithmetic, which is fast, but the several copies of the payload alive at once.
Can I encode several files at once, or a folder?
One file at a time, deliberately. A batch of Base64 strings has to be labelled and separated somehow, every tool invents its own format for doing that, and none of them is what the next tool expects — so the output stops being useful the moment it leaves the page. If you need a folder as one payload, zip it first and encode the archive: the ZIP keeps the names and the structure, and the Base64 stays a single string with one obvious meaning.
About encoding files in the browser
A file picked in a browser is a File, which is a Blob with a name — and crucially, a handle rather than the contents. Nothing is in memory until you ask for it, and Blob.slice produces another handle to part of the same file at no cost. That is what makes chunked encoding possible without a worker: take a slice, await its bytes, encode them, let the event loop run, repeat. The only constraint is where the cut falls. Base64 consumes three bytes and emits four characters, so a slice boundary that is not a multiple of 3 leaves a partial group that gets padded with = and the next slice starts a new group — the two halves concatenate into a string that decodes to something no one wants. 768 KB divides by 3 cleanly, which is the entire reason for that number.
The media type is the part that goes wrong quietly. Three sources claim to know it and they disagree constantly: the browser reports File.type from an operating-system lookup on the extension, the extension itself can be edited by anyone, and only the leading bytes are evidence. A signature is a fixed sequence at a fixed offset — 25 50 44 46 2D for a PDF, 1F 8B for gzip, 66 74 79 70 four bytes in for an MP4 container — and where one matches, it settles the question. Where it does not, and there are plenty of formats with no signature at all, the extension is the next-best guess and the page says that is what it used. Getting this right matters because the type is what goes into the data: URI, and a consumer trusts the label over the content.
The last thing worth understanding is the memory cost, because it is what sets the ceiling rather than any limit in the specification. A JavaScript string holds two bytes per character regardless of what the characters are, so 6,990,508 characters of ASCII Base64 occupy roughly 13.3 MB — on top of the original bytes, and on top of whatever the clipboard or the DOM is holding. Multiply that by an accidental copy or two and a 30 MB file is enough to make a tab unhappy on a modest machine. When the payload is genuinely large, Base64 is the wrong transport entirely: send the bytes as multipart/form-data, or as a binary body, and skip the encoding. Turning a string back into a file runs the same arithmetic in reverse, and pictures have their own page because they need a preview before you commit.
Where your file is read
Inside this browser tab and nowhere else. Each slice is read with the File API on your own machine, encoded in memory and forgotten when you clear the panel — this page has no upload endpoint, so there is nothing to disable and nothing to trust. Contracts, key material and internal builds all end up in encoders like this one, so the safest design is the one where the file cannot leave.