Base64 Encoder / Decoder

Encode and decode text to/from Base64 format.

Input

About This Tool

Base64 is a binary-to-text encoding scheme that uses 64 printable ASCII characters to represent binary data. It's commonly used in email, data URLs, and APIs.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of printable ASCII characters. It uses 64 different characters (A-Z, a-z, 0-9, +, /) to represent binary data, making it safe to transmit over text-based protocols that don't support binary data.

Originally developed for encoding email attachments (MIME), Base64 is now widely used in web development, APIs, data URIs, and anywhere binary data needs to be represented as text. It's especially common for embedding images directly in HTML/CSS, sending file data in JSON, and storing binary data in databases.

Important Note: Base64 is NOT encryption or security. It's simply an encoding method. Anyone can decode Base64 strings instantly - never use it to protect sensitive information without proper encryption.

How to Use This Base64 Tool

Encoding Text to Base64:

  1. Type or paste your text in the input field
  2. Click the "Encode" button
  3. Your Base64-encoded result appears instantly
  4. Click "Copy" to copy the result to your clipboard

Decoding Base64 to Text:

  1. Switch to "Decode" mode
  2. Paste your Base64 string in the input field
  3. Click "Decode" to see the original text
  4. Copy the decoded result if needed

Encoding Files to Base64:

  1. Switch to "File to Base64" mode
  2. Upload any file (images, PDFs, documents, etc.)
  3. The tool converts it to a Base64 string
  4. Use this string in data URIs, APIs, or databases

Decoding Base64 to Files:

  1. Switch to "Base64 to File" mode
  2. Paste your Base64 string
  3. Specify the output filename and extension
  4. Click "Download" to save the decoded file

Common Use Cases for Base64

  • Email Attachments: MIME protocol uses Base64 to encode file attachments in emails, ensuring they can be transmitted safely over email servers that only support text.
  • Data URIs in HTML/CSS: Embed small images directly in your HTML or CSS using Base64 data URIs: data:image/png;base64,iVBORw0KG... This reduces HTTP requests and improves performance for small assets.
  • API Communication: Send binary files (images, documents) in JSON payloads by encoding them as Base64 strings. This is common in RESTful APIs that need to handle file uploads.
  • Storing Images in Databases: Some developers store small images as Base64 strings in text database fields, though this isn't always recommended for large files due to size increase.
  • Authentication Tokens: JWT tokens and many authentication systems use Base64 encoding for token headers and payloads (though they're not encrypted - use HTTPS for security).
  • CSS Font Embedding: Web fonts can be embedded in CSS files using Base64 to reduce external file requests and improve page load times.

Why Does Base64 Increase File Size?

Base64 encoding increases data size by approximately 33%. This happens because Base64 uses 6 bits per character to represent 8 bits of original data. Every 3 bytes (24 bits) of binary data becomes 4 characters (24 bits) in Base64.

Example: A 100KB image becomes approximately 133KB when Base64 encoded. For this reason, Base64 is best used for small files or when the benefits (fewer HTTP requests, embedding in JSON/HTML) outweigh the size increase.

Frequently Asked Questions

Q: Is Base64 encoding secure?

No, Base64 is NOT encryption or security. It's simply a way to represent binary data as text. Anyone can decode Base64 strings instantly using any decoder tool. Never use Base64 alone to protect passwords, API keys, or sensitive data. Always use proper encryption (AES, RSA) and HTTPS for security.

Q: What's the maximum file size I can encode?

Our tool runs entirely in your browser, so the limit depends on your device's memory. Modern browsers can typically handle files up to 50-100MB, but very large files may slow down or freeze your browser. For files over 10MB, we recommend using command-line tools or server-side processing.

Q: Is my data safe? Do you upload files to your server?

Absolutely safe! All encoding and decoding happens entirely in your browser using JavaScript. Your files and data NEVER leave your device - nothing is uploaded to our servers. You can even use this tool offline after the page loads. Check our Privacy Policy for details.

Q: Can I encode images to Base64?

Yes! Upload any image format (PNG, JPG, GIF, SVG, WebP, etc.) and convert it to a Base64 data URI. This is perfect for embedding small images in HTML, CSS, or JSON. The output will look like:data:image/png;base64,iVBORw0KG...

Q: What's the difference between Base64 and Base64URL?

Base64URL is a URL-safe variant that replaces + with - and / with _ to avoid issues in URLs and filenames. It's commonly used in JWT tokens. Our standard Base64 encoder uses the traditional alphabet, but the output can be manually converted if needed.

Q: Why do I see "=" characters at the end of Base64 strings?

The "=" character is padding used when the input length isn't divisible by 3. It ensures the Base64 output length is always divisible by 4. This padding is optional in some contexts but required by strict Base64 standards.

Privacy & Security

Your privacy is our priority. This Base64 encoder/decoder operates entirely client-side in your browser. No data is transmitted to our servers, no files are uploaded, and nothing is logged or stored. You can verify this by checking your browser's network tab - you'll see zero requests when using the tool.

The tool works offline once the page loads, and the source code is open source on GitHub for complete transparency. Feel confident encoding sensitive documents, API tokens, or any data - it stays on your device.

Related Tools