Encode or decode Base64 - text, images, PDFs and any file - with URL-safe mode and automatic file-type detection.
Last updated:
Nothing is uploaded, so it is safe for tokens, keys and private files.
| Task | Tab | Also searched as |
|---|---|---|
| Encode text | Text → Encode | base64 encode, text to base64, string to base64 |
| Decode text | Text → Decode | base64 decode, base64 to text, decode base64 string |
| Image to Base64 | File → Base64 | image to base64, png to base64, jpg to base64 |
| Base64 to image | Base64 → File | base64 to image, base64 to png, base64 image viewer |
| Base64 to PDF | Base64 → File | base64 to pdf, decode base64 pdf |
| URL-safe | Text + URL-safe | base64url encode, base64url decode |
| Variant | Characters | Padding | Used in |
|---|---|---|---|
| Standard | + and / | = at the end | Email, data URIs, most APIs |
| URL-safe (Base64URL) | - and _ | Usually removed | JWTs, URLs, file names |
| Language | Encode | Decode |
|---|---|---|
| JavaScript (browser) | btoa(str) - ASCII only; use TextEncoder for UTF-8 | atob(b64) |
| Node.js | Buffer.from(str).toString("base64") | Buffer.from(b64, "base64").toString() |
| Python | base64.b64encode(b"text") | base64.b64decode(s) |
| Java | Base64.getEncoder().encodeToString(bytes) | Base64.getDecoder().decode(s) |
| PHP | base64_encode($s) | base64_decode($s) |
| Linux / Mac | base64 file.png | base64 -d file.txt > out.png |
| Situation | Use Base64? |
|---|---|
| Tiny icons under ~4 KB | Yes - saves an HTTP request |
| Images in HTML emails | Often blocked - prefer hosted links |
| Large photos | No - 33% bigger and cannot be cached separately |
| Files inside JSON APIs | Yes, for small files |
| Fonts and SVG in CSS | Sometimes - SVG can also be URL-encoded instead |
Paste it in the Base64 box; with Live on, the text appears instantly. For images or PDFs use the Base64 → File tab.
Open File / Image → Base64, choose the image and copy the result - with or without the data URI prefix.
Paste the string in Base64 → File. The file type is detected; preview images and download any file.
No. It is a reversible encoding - anyone can decode it. Use encryption for secrets.
A variant that uses - and _ instead of + and / and drops = padding, so it is safe in URLs and JWTs.
Every 3 bytes become 4 characters, so the output is about 33% larger.
Yes. Text is encoded as UTF-8.
No. Everything is processed in your browser.