Base64 Encode & Decode Online

Free Base64 encoder, decoder, and translator. Convert text to Base64, decode Base64 to text, decode Base64 images, encode files, and more — instantly in your browser. No upload, no signup.

Ad slot
Ready
Input — Base64 string
Output — decoded text

          
        
Ad slot

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

  1. Choose a mode — Decode (Base64 → text/file) or Encode (text/file → Base64).
  2. Paste or type your input. You can also drag & drop a file or click "Upload file."
  3. The result appears instantly in the output panel as you type.
  4. 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:

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.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable characters (A-Z, a-z, 0-9, +, /). It is widely used to embed binary data — images, files, cryptographic keys — in text-based formats like JSON, XML, email, and HTML.

How do I encode text to Base64 online?

Switch to Encode mode, paste your text in the input, and the Base64 result appears instantly in the output. Click Copy to copy or Download to save as a file.

How do I decode Base64 online?

Switch to Decode mode (the default), paste your Base64 string in the input, and the decoded text appears immediately. If the decoded data is an image, the tool shows a live preview; if it's a file like a PDF, you can click Download.

How do I decode a Base64 image?

Paste the Base64 image string (with or without the data:image/png;base64, prefix). The tool detects image data automatically and shows a live preview. Click Download to save the image as a PNG, JPG, or GIF.

Is Base64 the same as encryption?

No. Base64 is encoding, not encryption. The encoded data can be decoded by anyone — there is no key or password. People sometimes call it "decrypt Base64" but technically Base64 is just a format for representing binary data as text.

Is my data uploaded to any server?

No. All encoding and decoding happens locally in your browser using JavaScript. Your data, files, or images never leave your device.

What is URL-safe Base64?

URL-safe Base64 (RFC 4648) replaces + with - and / with _ so the encoded string can be safely used in URLs and filenames. Padding (=) is also typically omitted. Toggle the URL-safe checkbox above the input to use this variant.

Can I convert a file to Base64?

Yes. Click the file upload button or drag and drop any file (image, PDF, document, audio, video) into the input area. The tool will convert the file to a Base64 string. This works with files up to several megabytes.

Can I convert Base64 back to a file or PDF?

Yes. Paste the Base64 string and decode it. If it's an image, you'll see a preview; for any binary data including PDFs, click Download to save the original file.

What is the difference between Base64 and Base32?

Base32 uses 32 characters (A-Z and 2-7) instead of 64. It produces longer output but is more readable and case-insensitive, which makes it useful for human-typed codes such as TOTP secrets. Base64 is more compact and is the standard for binary data in JSON, XML and email. Use the Variant dropdown to switch.

How do I encode Base64 in Python?

Use the standard library: base64.b64encode(b"text").decode("ascii") to encode and base64.b64decode(encoded).decode("utf-8") to decode.

How do I encode Base64 in JavaScript?

In the browser, use btoa("text") to encode and atob(encoded) to decode. In Node.js, use Buffer.from("text").toString("base64").

How do I encode Base64 in PHP?

Use base64_encode($text) to encode and base64_decode($encoded) to decode.

How do I encode Base64 in Java?

Use Base64.getEncoder().encodeToString(text.getBytes()) to encode and new String(Base64.getDecoder().decode(encoded)) to decode.

What characters are allowed in Base64?

Standard Base64 uses A-Z, a-z, 0-9, +, /, and = for padding. URL-safe Base64 replaces + with - and / with _.

Why does my Base64 string have equals signs at the end?

The equals signs are padding characters added when the input length is not a multiple of 3 bytes. They make the encoded output a multiple of 4 characters. Some implementations omit padding (especially URL-safe Base64), but standard Base64 includes it.