🔤Base64 Encode & Decode - Free Online Base64 Converter
Convert text or files to Base64, or turn Base64 back into what it was. When encoding, type text or choose any file (image, PDF, font and so on), optionally with a data: prefix ready for a web page. When decoding, paste plain Base64 or a whole data URI such as data:image/png;base64,…; if the result is a file such as an image, PDF or archive, the tool recognizes the type, previews images and lets you download it. Text is handled as UTF-8, and legacy GBK-encoded Chinese is detected automatically. Everything runs in your browser and nothing is uploaded.
Loading tool...
How to use Base64 Encode/Decode
- 1Choose Encode or Decode
- 2To encode, type text or click Choose a file…; tick Include data: prefix to use the result directly in a web page
- 3To decode, paste the Base64 or a whole data URI; line breaks and spaces are ignored
- 4The result appears instantly: Copy result for text, Download file when it decodes to a file
FAQ
- Is Base64 encryption? Can it keep things secret?
- No. It is just another way of writing data: any bytes expressed with 64 characters (A-Z, a-z, 0-9, + and /) so they fit where only text is allowed, such as JSON, URLs, email and HTML. Anyone can reverse it instantly with a decoder like this one; there is no key. Do not use it to protect passwords or private data; use real encryption for that.
- Why is the encoded result bigger?
- Base64 turns every 3 bytes into 4 characters, so the size always grows by about a third (plus any trailing =). In our tests a 6.68 KB PNG became 9,128 characters and a 6 MB file over 8.38 million. That is why Base64 images in web pages are best kept to small icons of a few KB.
- How do I convert an image to Base64, or Base64 back to an image?
- To encode, click Choose a file…, pick the image and tick Include data: prefix; the resulting data:image/png;base64,… can go straight into an HTML src or a CSS url(). To restore it, paste the whole string (with or without the data: prefix) into Decode: the tool shows that it is a PNG image with a preview, and Download file saves it. To get ready-made CSS background or HTML <img> code, see Image to Base64.
- The decoded result is gibberish. What now?
- Most likely the content was never text. The tool recognizes common file types from their first bytes (images, PDF, ZIP, audio, video, fonts) and offers a download; even an unrecognized type can be downloaded and opened with the right program. If it is garbled Chinese, it may be legacy GBK data, which the tool retries automatically and tells you about; rarer traditional or uncommon characters outside the common GBK range may not be detected.
- What is URL-safe Base64?
- In standard Base64, + and / have special meanings in URLs and = is often escaped, so URL parameters, JWT tokens and file names commonly use a variant that replaces + with -, / with _ and drops the trailing =. Tick URL-safe when encoding to get it; when decoding there is nothing to choose, since both forms are recognized.
- Can it decode Base64 with line breaks or spaces?
- Yes. Email attachments and some certificate files wrap Base64 every 76 characters; line breaks and spaces are ignored when decoding, and missing = padding at the end is added back automatically.
- Are my files or data uploaded?
- No. Everything runs locally in your browser with no network upload, and is discarded when you close the page.
- Do I need to sign up or pay?
- No. The site is completely free, needs no account and has no usage limits.
Features
- Encode text or any file, optionally as a data URI
- Recognizes PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, MP4, fonts and more when decoding, with image preview and download
- Paste a data URI directly; the data:…;base64, prefix is stripped automatically
- UTF-8 text, with automatic detection of legacy GBK-encoded Chinese
- Optional URL-safe output (- _ instead of + /, no trailing =); both forms are accepted when decoding
- Handles files of several MB; copy or download the full result as text