
Base64 Encode/Decode: Text, Files and Images Online
Encode or decode text, a file, or an image as Base64 in the browser — data URIs, email attachments, JWT segments. 100% local, not encryption.
Why Base64 still shows up in every stack
A CSS background that cannot fetch a file, a MIME attachment that must travel as ASCII, a JWT segment sitting between two dots, a WordPress option that was serialized then wrapped in Base64: none of these are encryption problems. They are transport problems. The online Base64 encoder and decoder turns Unicode text into an ASCII-safe alphabet and back, entirely in the tab. The image to Base64 converter does the same for a local PNG, JPEG, GIF, WebP or SVG — as a data URI or as raw Base64. Nothing is uploaded. Base64 is not a hash, not a cipher, and not a substitute for TLS. It is a way to carry bytes through channels that only like letters, digits, +, / and padding. The cluster lives on the encoding tools hub.
When to encode in the browser, and when not to
The encoder is a scalpel for a string you can paste, not a CDN.
If the answer depends on a file the browser should not hold, or on cryptography, stay in CI or a secret manager.
The Base64 mistakes that burn an afternoon
Anyone who can read the string can decode it. Base64 has no key, no integrity check, and no confidentiality. A token that looks opaque in a log is still plaintext after one decode. If the bytes must stay secret, encrypt (or do not put them in the payload). If they must stay authentic, sign — HMAC or a JWT signature, not Base64 itself.
RFC 4648 defines two alphabets. Standard Base64 uses + and / and usually keeps = padding. URL-safe Base64 (the JWT, cookie, and path flavour) uses - and _ and typically drops padding. FastMinify's URL-safe toggle does both substitutions and omits padding on encode. Decode in URL-safe mode maps the alphabet back and restores padding. If the toggle does not match the string, you get an invalid-input error — not a "close enough" decode.
A compact JWT is three Base64URL segments separated by dots: header.payload.signature. The dots are not Base64. The Base64 tool decodes one alphabet string, not a dotted token. The error copy on the page says so: paste only the encoded characters, no dots; for a JWT, copy each part between the dots — or, simpler, open the JWT decoder and inspect header plus payload in one step.
Base64 expands binary data by about 33% (3 bytes become 4 ASCII characters). A 200 KiB JPEG becomes ~267 KiB of CSS. That CSS is ineligible for a separate cache, blocks parsing, and fights HTTP/2 multiplexing. Data URIs earn their keep for tiny icons that would otherwise cost a request. They lose for hero images, product photos, and anything you already minify as a file.
Standard Base64, URL-safe, data URI — pick the representation
The bytes do not change. The spelling does. Standard Base64 is what email MIME and most APIs emit. URL-safe Base64 is what JWTs, signed cookies, and path segments need so + and / do not collide with query syntax. A data URI is standard Base64 with a data:<mime>;base64, prefix so a browser can treat the string as a resource.
Three tools, three inputs. The text encoder runs UTF-8 then Base64 on a string (paste or a text file). It will not interpret a PNG as pixels. The image converter reads file bytes, checks MIME (PNG, JPEG, GIF, WebP, SVG — empty MIME is rejected, no silent sniff), caps at 32 MiB, and emits a data URI or raw Base64. Preview uses an img element only: SVG is never injected into the DOM as markup. For SVG-as-CSS with utf-8 or Base64 encoding and a dedicated CSS snippet, use the SVG to data URI tool on the SVG hub (512 KiB SVG input — a different cap, a different job).
Developers mash these together because they all "make a string safer". They solve different collisions. URL encode percent-encodes reserved URI characters. HTML entities escape markup so a string can sit in an attribute. A hash (SHA-256, HMAC) is one-way integrity or authenticity — see the encoding hub's hash/HMAC tools, not this article. Base64 only changes how bytes are written.
What Base64 actually does to your bytes
Base64 takes 24 bits (3 bytes) and writes them as 4 characters from a 64-symbol alphabet. That is why the output is longer: 4/3, about 33% more, plus padding if the input length is not a multiple of 3. The tax is the point — you trade size for an alphabet that survives email, JSON strings, and CSS. It is the opposite of minification. If the payload is JSON you will ship over HTTP, minify the JSON first, then encode only if a wrapping layer requires ASCII; see the JSON minification guide.
Before
After
JavaScript's built-in btoa operates on a binary string (values 0–255). Pass it café and it throws or produces a lie, depending on the engine. FastMinify encodes the UTF-8 bytes with TextEncoder, then Base64 — the same contract as Node Buffer.from(text, 'utf8').toString('base64'). Decoding reverses it with TextDecoder. Emoji and CJK survive. If you decode a blob that was never UTF-8 text (a PNG, a gzip stream), you get replacement characters, not a file — that blob belongs in image-to-base64 or a hex dump, not in a text field.
Before
After
When the byte length is not a multiple of 3, standard Base64 appends = or == so the string length is a multiple of 4. URL-safe contexts (JWT, some cookies) omit that padding because = is a query delimiter. FastMinify URL-safe encode strips it; URL-safe decode puts it back before atob. Classic RFC examples: f → Zg==, fo → Zm8=, foo → Zm9v.
Before
After
Encode in the tab: text, then a file, then an image
Open the Base64 encoder/decoder. Paste the text (or upload a text file — client ceiling 32 MiB, same family cap as other file picks on the site). Choose Encode or Decode. Leave URL-safe off for MIME, data-URI payloads, and most API examples. Turn it on for JWT segments, signed cookie values, and anything that will sit in a path. Load sample if you only want to see the pipeline. Everything stays in the tab.
Step 1 — Paste or upload the source
Unicode text for encode; a Base64 alphabet string for decode. Do not include JWT dots or a data: prefix.
Step 2 — Set URL-safe to match the producer
On: - _ and no padding. Off: + / and = padding. A mismatch is an error, not a partial decode.
Step 3 — Copy the result
If you decoded JSON that was minified, send it to the JSON formatter or the online JSON unminifier — format only, names already lost stay lost.
Open the image to Base64 tool. Drop a PNG, JPEG, GIF, WebP or SVG (max 32 MiB). Choose data URI for CSS url() and img src, or raw Base64 to pipe into another tool. Preview renders through an img element; SVG is not mounted as DOM. Empty or exotic MIME types are rejected — the tool does not guess. After a tiny icon, you can paste the URI into CSS. After a photograph, you usually should not.
Encoding is usually one step in a longer debug. The encoding hub keeps the neighbours one click away.
When the browser is enough — and when you still need a REPL
If the string already lives in a script, Node's Buffer matches FastMinify's UTF-8 then Base64 path. Use base64url when the consumer is a JWT library.
Basic example
The native btoa / atob pair is a binary-string API. Wrap it with TextEncoder/TextDecoder, or you will corrupt anything outside Latin-1. That wrap is what the FastMinify text tool already does.
Basic example
A local PEM, a binary fixture, or a CI job that must not open a browser: openssl stays the right hammer. FastMinify will not replace a pipeline that already hashes or signs files on disk.
Basic example
No install, no upload, UTF-8 text plus a dedicated image converter with an honest 32 MiB cap and a URL-safe toggle. Trade-off: the text tool is not a binary file encoder; HEIC/PDF are out of scope for the image tool; JWT verification is a different page. Use it to inspect, teach, and unblock a machine without Node — then keep openssl or Buffer in CI.
Conclusion
Base64 is a boring, essential adapter: bytes in, ASCII-safe alphabet out, 33% larger, fully reversible. FastMinify runs that adapter in the browser — UTF-8 text with an optional URL-safe alphabet, and a separate image converter (PNG, JPEG, GIF, WebP, SVG, 32 MiB) that emits a data URI or raw Base64 without injecting SVG into the DOM. It does not encrypt, it does not hash, and it does not replace jwt-verify or a CDN. Encode the snippet, decode the log line, inline the icon, then stop. Start on the encoding tools hub, and open JWT decode when the string has two dots.
Related Articles

Compile SCSS or LESS snippets (variables, nesting, mixins) to CSS in the browser without npm run build — for reviews, snippets, or a machine without Node.

Insufficient text-to-background contrast is the most common accessibility failure on the web. Check AA/AAA compliance by pasting two colors, no plugin or extension required.

Meta description 155 characters, title ~60, tweet 280: count words and characters in the browser with FastMinify's word counter — SEO presets, reading time, 100% local.