Base64 Encoder & Decoder
Encode or decode text and files as you type. Detects the direction, handles URL-safe Base64, data URIs, images and PDFs.
The decoded text is valid JSON This looks like a JSON Web Token (JWT)
- Type
- File size
- Base64 size
Inlining images over ~10 KB usually slows pages down. Compress it first or serve it as a normal file.
Standard vs URL-safe
Standard Base64 uses + and /. URL-safe Base64 (RFC 4648 §5) swaps them for - and _ and usually drops the = padding. JWTs and many APIs use it. The decoder reads both.
Data URIs
A data URI puts a file inside a link: data:image/png;base64,iVBOR…. Paste one here to see and download the file, or use the File tab to make one for HTML or CSS.
Not encryption
Anyone can decode Base64. To protect data, hash it with the Hash Generator or sign it with the HMAC Generator. For links, use the URL Encoder.
About the Base64 Encoder/Decoder
Base64 turns any data into plain text using 64 safe characters (A–Z, a–z, 0–9, + and /). It is used to send binary data in email, JSON, data URIs, HTTP headers, and JWTs. This tool encodes and decodes text with full UTF-8 support, turns files and images into Base64 or data URIs, and decodes Base64 back into the original file.
How to use it
- 1 Paste text or Base64 into the input. Auto mode picks encode or decode for you.
- 2 Turn on URL-safe or line wrapping if the place you paste into needs it.
- 3 Copy or download the result. Decoded images and PDFs show a preview and a download button.
- 4 To encode a file or image, open the File tab and drop it in to get Base64, a data URI, or an HTML/CSS snippet.
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.
Why does Base64 output end with = signs?
Base64 works on groups of 3 bytes. When the input length is not a multiple of 3, one or two = characters are added as padding. URL-safe Base64 often leaves them out, and this decoder accepts input with or without them.
What is the difference between Base64 and URL-safe Base64?
URL-safe Base64 (RFC 4648 section 5) replaces + with - and / with _, so the result can go into a URL, filename, or cookie without escaping. JWTs use URL-safe Base64 without padding.
How much bigger does Base64 make data?
Base64 output is about 33% larger than the original, because every 3 bytes become 4 characters. Line wrapping adds a little more.
How do I convert an image to Base64?
Open the File tab and drop the image in. You get the raw Base64, a data URI, and ready-to-paste HTML <img>, CSS background, and Markdown snippets. Keep inlined images small (under about 10 KB) so pages stay fast.
How do I turn Base64 back into a file?
Paste the Base64 or data URI into the input. The tool recognises PNG, JPEG, GIF, WebP, SVG, PDF, ZIP, fonts and more, shows a preview for images, and gives you a download button with the right file extension.
Why do I get “Invalid character”?
Base64 can only contain letters, digits, + / (or - _) and = at the end. The error shows the exact position; click “Show me” to highlight it. Spaces and line breaks are ignored automatically.
Is my data uploaded?
No. Encoding and decoding happen in your browser with JavaScript. Text and files never leave your device.