Free Online Base64 Encoder and Decoder
This Base64 encode and decode online tool converts text, files, images, and any binary data to and from Base64 format. Whether you need to encode text to Base64, decode Base64 to text, convert Base64 to image, or convert a file to Base64, this Base64 translator handles it all in one place.
Everything runs in your browser. No data is uploaded, logged, or stored on any server. That makes this Base64 converter safe to use with sensitive content like authentication tokens, API keys, signed cookies, JWT payloads, encrypted blobs, and private documents.
How to Use the Base64 Encoder/Decoder
- Choose a mode — Decode (Base64 → text/file) or Encode (text/file → Base64).
- Paste or type your input. You can also drag & drop a file or click "Upload file."
- The result appears instantly in the output panel as you type.
- Click Copy to copy the result, or Download to save as a file.
Decode Base64 to Text Online
To Base64 decode any text: switch to Decode mode (selected by default), paste your Base64 string into the input box, and the decoded text appears immediately. The Base64 decoder handles standard Base64, URL-safe Base64 (with - and _), and Base64 with or without padding.
Example: decoding Base64
Input:
SGVsbG8sIFdvcmxkIQ==
Output:
Hello, World!
Encode Text to Base64 Online
To encode text to Base64: switch to Encode mode, paste your text, and the Base64 representation appears instantly. The tool encodes the text as UTF-8 by default (Latin-1 is also available for legacy systems).
Example: encoding text
Input:
Hello, World!
Output:
SGVsbG8sIFdvcmxkIQ==
Decode Base64 to Image, PDF, or File
One of the most common uses of this tool is to Base64 decode image data — for example, when you receive an image embedded in a JSON API response or extracted from a data URL. Paste the Base64 image string (with or without the data:image/png;base64, prefix) and the decoded image appears as a live preview. You can then download it as a PNG, JPG, GIF, or whatever the original format was. This is the easiest way to convert Base64 to image online.
The same approach works for any binary file. To do Base64 to file conversion or Base64 to PDF, paste the encoded data and click Download — you'll get the original file. To convert files in the other direction (file to Base64), drop the file onto the input or click "Upload file" and the tool returns the Base64-encoded string.
You can also use this tool to convert Base64 to JSON (when the encoded payload is a JSON document — the decoded text will be the original JSON), or to convert a string to Base64 by switching to encode mode and pasting any text.
URL-safe Base64 (RFC 4648)
Standard Base64 uses three special characters — +, /, and = — that need to be percent-encoded inside URLs. URL-safe Base64 (defined in RFC 4648) avoids the problem by replacing + with - and / with _. The trailing = padding is also typically removed.
Toggle the URL-safe checkbox above the input to switch variants. This is useful when working with JWT tokens, OAuth flows, or anywhere Base64 appears inside a URL or filename.
Base64 in Python, JavaScript, PHP, and Java
For developers who want to do Base64 encoding programmatically rather than in a browser, here are the standard library calls in popular languages.
Python
import base64
encoded = base64.b64encode(b"Hello, World!").decode("ascii")
decoded = base64.b64decode(encoded).decode("utf-8")
JavaScript
// In the browser
const encoded = btoa("Hello, World!");
const decoded = atob(encoded);
// In Node.js
const encoded = Buffer.from("Hello, World!").toString("base64");
const decoded = Buffer.from(encoded, "base64").toString("utf-8");
PHP
$encoded = base64_encode("Hello, World!");
$decoded = base64_decode($encoded);
Java
import java.util.Base64;
String encoded = Base64.getEncoder().encodeToString("Hello, World!".getBytes());
String decoded = new String(Base64.getDecoder().decode(encoded));
Common Uses for Base64
Whether you're working with a Base64 file, converting Base64 to string, or embedding binary data in text:
- Embedding images in HTML/CSS as
data:image/png;base64,...URLs. - JSON API responses that include binary data such as PDFs, images, or signatures.
- Email attachments (MIME) — Base64 keeps binary attachments safe through text-based mail relays.
- JWT tokens — header, payload, and signature segments are URL-safe Base64.
- Configuration files that need to embed binary keys, certificates, or images.
- Storing binary data in a database column that only accepts text.
Is Base64 Encryption?
No. People often search for "decrypt Base64 online" but Base64 is encoding, not encryption. The encoded data can be decoded by anyone — there is no key, password, or secret. Base64 is just a way of representing binary data using a limited set of text characters. If your data needs to be confidential, you must encrypt it (with AES, RSA, etc.) before encoding it.
Convert Base64 to Other Formats
If you want to take the decoded output and convert it further, our companion tools handle most formats:
- URL Encode / Decode — for percent-encoded strings
- JWT Decoder — JWT tokens are Base64-encoded segments
- JSON Formatter — if your decoded Base64 is JSON
- HTML Entity Encode/Decode — for HTML-safe text
- Hex ↔ Text — convert between hex and text
- Image to Base64 — dedicated image-to-Base64 converter
Privacy & Security
This Base64 converter runs entirely client-side. Your input never leaves your browser. You can verify this by opening the Network tab of your browser developer tools and confirming no requests are made when you type in the input.
This makes the tool safe for sensitive data such as authentication tokens, API keys, customer information, and confidential documents.