🔄 Base64 Decode — Convert Base64 to Text Online

Decode any Base64 string back to plain text or download a file. Also encodes text and files to Base64. Free, instant, no signup.

Paste any Base64 string into the input area and click Decode. The tool instantly decodes it back to readable text. Switch to File mode to decode Base64-encoded files. Works for Base64-encoded images, PDFs, and any binary data.

How to Use

1

Choose mode

Select Text mode for plain text encoding/decoding, or File mode to encode any file.

2

Enter your input

Type or paste text, then click Encode or Decode. For files, drag and drop or click to browse.

3

Copy the output

Click Copy to copy the Base64 output to your clipboard for use in your project.

Frequently Asked Questions

What is Base64 encoding? +
Base64 converts binary data (like images or files) into ASCII text using 64 characters (A–Z, a–z, 0–9, +, /). It's used to embed images in CSS/HTML, transmit data in JSON APIs, and store binary data in text formats.
How do I use Base64 images in CSS? +
After encoding an image, copy the output and use it as: background-image: url('data:image/png;base64,YOUR_BASE64_HERE'). This embeds the image directly in your CSS, eliminating an HTTP request.
Is Base64 encoding the same as encryption? +
No. Base64 is encoding, not encryption. Anyone can decode Base64 text instantly. Never use it to hide sensitive information.
Why does Base64 encoded text end with == ? +
Base64 pads output to a multiple of 4 characters using = signs. One = means 1 padding byte, == means 2 padding bytes.
Can I encode files to Base64? +
Yes — switch to File mode, select any file, and the tool instantly shows its Base64 representation. Works for images, PDFs, fonts, and any binary file.


Complete Guide: Base64 Encoder & Decoder

What Is Base64 and Why It Matters

Base64 is a binary-to-text encoding scheme that represents binary data using only 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It was designed in the 1980s to safely transmit binary content — images, executables, certificates — through text-only channels like email (MIME), HTTP headers, and XML documents that reject arbitrary bytes.

The most important thing to understand upfront: Base64 is encoding, not encryption. Anyone who has the Base64 string can trivially decode it. It provides zero confidentiality. Its only purpose is format compatibility — converting binary data into text that won't be corrupted by systems that mishandle raw bytes.

Where you encounter it daily: inline images in HTML or CSS (data:image/png;base64,…), HTTP Basic Authentication headers (Authorization: Basic dXNlcjpwYXNz), JSON Web Tokens (Base64url-encoded header and payload), email attachments encoded by MIME, and binary payloads in REST APIs that need to travel inside JSON fields.

How to Use This Base64 Tool

  1. Choose Text or File mode using the tabs at the top of the tool.
  2. Text mode: paste or type your text, then click Encode or Decode.
  3. File mode: drag-and-drop any file (image, PDF, font) onto the upload area. The encoded output appears instantly.
  4. Copy the output with the Copy button. For data URIs, use the "Copy as Data URI" option to get the full data: prefix.

Code Examples

// Browser: encode/decode text
const encoded = btoa('Hello, World!');    // 'SGVsbG8sIFdvcmxkIQ=='
const decoded = atob('SGVsbG8sIFdvcmxkIQ=='); // 'Hello, World!'

// Node.js: encode a buffer (binary-safe)
const buf = Buffer.from('Hello, World!');
const b64 = buf.toString('base64');         // 'SGVsbG8sIFdvcmxkIQ=='
const back = Buffer.from(b64, 'base64').toString('utf-8');

// CSS: inline a small SVG icon as a data URI
const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">...</svg>';
const dataUri = `data:image/svg+xml;base64,${btoa(svg)}`;
// background-image: url("data:image/svg+xml;base64,...")

// HTTP Basic Auth header
const credentials = btoa('username:password');
// Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

// Base64url (JWT-safe): replace + with -, / with _, strip padding
const b64url = btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');

Common Mistakes to Avoid

Comparison with Alternatives

URL encoding (percent-encoding) is used for query string parameters — it encodes characters that are illegal in URLs (%20 for a space). Use it for URLs, not binary data. Hex encoding represents each byte as two hex digits; it's used for hashes, colors, and byte-level debugging, but produces 100% overhead vs Base64's 33%. Binary transfer via multipart form data is more efficient than Base64 for file uploads but requires the server to handle multipart parsing.

For image-to-Base64 conversion with a data URI preview, use the specialized Image to Base64 tool. For understanding JWT tokens that use Base64url encoding internally, see the JWT Decoder.

Pro Tips

🧰 50+ Tools