Convert Any File to Base64
EncodingEverything runs locally in your browser — nothing is uploaded
Turn a file into Base64 text — drop it in and nothing gets uploaded. The data URL it produces (`data:image/png;base64,…`) pastes straight into `<img src>`, a CSS `url()` or a JSON field, saving a request; that is how small but critical assets (icons, small fonts, loading placeholders) are usually shipped. ⚠️ Do not make a habit of it, though. Base64 inflates the size by about a third, and because it travels inside HTML/CSS the browser loses independent caching and parallel fetching for that asset — beyond a few kilobytes the page gets slower, not faster. The test is simple: ask whether the file is bigger than a few KB before inlining it. The limit here is 4 MB, and the reason is not compute but the page: a 4 MB file becomes a 5.5 MB string, and rendering that much text in the DOM visibly stalls the browser. The hash tool handles 512 MB because its output is always the same length — how much is read has nothing to do with how much comes out. For anything larger, `base64 -w0 input > output.txt` on the command line.
Features
- Any file type, drag and drop, producing Base64 and the full data URL
- The headline is the data URL with a copy button — ready for src, url() or JSON
- Lists the file name, original size, encoded size, MIME and actual length
- Treats an empty MIME as application/octet-stream instead of guessing
- States the cost of Base64 (a third larger, no independent caching) rather than just the result
- Nothing is uploaded; works offline
How to use
- Drag your file onto the dashed area
- The data URL appears at the top — copy it with the button on the right
- The table below shows sizes, MIME and the encoded length
- Paste it into src, url() or a data field
FAQ
- What is the difference between Base64 and a data URL?
- Base64 is the encoded text itself; a data URL is the complete address that carries the type: `data:image/png;base64,` followed by that text. Pasting into `src` or `url()` needs the latter — given bare Base64 the browser does not know what it is. This tool gives you both, with the usable data URL as the headline.
- Why is inlining everything as Base64 a bad idea?
- Three costs. Size: Base64 is about a third larger (three bytes become four characters). Caching: an inlined asset travels with the HTML/CSS, so any change means re-downloading the whole block, whereas a separate file caches on its own. Parallelism: the browser can no longer fetch that asset in parallel. The rule of thumb is a few KB, and only for things that will actually be used — small icons, a 1×1 placeholder, a hundred bytes of font. Reference large files normally.
- How large a font can I inline in CSS?
- Fonts are the best candidates for inlining: they block text rendering, so every extra request is a longer blank period (FOIT). But a CJK font can run to several megabytes — that is a case for inlining a subset (only the glyphs actually used), not the whole file. Latin fonts are usually 10–30 KB, and inlining those is routine. For CJK, subsetting matters far more than inlining.
- Why the 4 MB limit?
- Because the Base64 output is text that has to go into the DOM to be displayed and copied. A 4 MB file becomes a 5.5 MB string, and rendering that much text already strains the browser. The hash tool takes 512 MB because its output is always a fixed-length digest — reading more bytes does not produce more text. For larger files use `base64 -w0 input > output.txt`.
Related tools
Image to Base64
WebConvert an image to Base64 or a data URL by dropping, choosing or pasting it. Resize and switch format, all locally — nothing is ever uploaded.
Base64
EncodingConvert text to Base64 and back, with correct UTF-8 handling for accents, CJK and emoji. Runs entirely in your browser — nothing is uploaded.
Base64 to File
EncodingDecode Base64 or a data URL into a downloadable file, with the type and extension detected for you. Line breaks and missing padding are handled.
URL Encode
EncodingEscape text into %XX form and back again, treating a whole URL and a single parameter value as different jobs. Runs entirely in your browser.
HTML Entities
EncodingTurn < > & and quotes into HTML entities and decode them back in a single pass, so &lt; becomes <, not an angle bracket. Runs in your browser.
JWT Decoder & Verifier
EncodingDecode a JWT and verify an HS256, HS384 or HS512 signature with your secret, reading exp and nbf as dates. All local to your browser.