Skip to content

Base64 Encoder/Decoder

Encode and decode Base64 data with support for Standard, URL-safe, and MIME variants. Perfect for API authentication, data URIs, email attachments, and binary data transmission.

Category: text
Use Case: API Authentication, Data URIs, Email Attachments
Privacy: 100% browser-based

Encoding Options

Standard A-Z, a-z, 0-9, +, /

RFC 4648 compliant padding

Every 76 characters

0 characters

Recommended Settings

Base64 Encoding Best Practices

  • Use Standard Base64 for APIs, JSON, and general data transmission
  • Use URL-safe Base64 for query parameters, filenames, and web URLs
  • Use MIME Base64 for email attachments (RFC 2045 compliant)
  • Base64 increases data size by ~33% - consider compression for large files
  • Remember: Base64 is encoding, not encryption - don't use it for security

Common Use Cases

  • HTTP Basic Auth: Encode username:password for Authorization headers
  • Data URIs: Embed images in HTML/CSS (data:image/png;base64,...)
  • API tokens: Encode bearer tokens for safe transmission in headers
  • Email attachments: MIME Base64 encoding for binary email attachments
  • JSON/XML: Encode binary data for inclusion in text-based formats

Pro Tips

  • Live conversion updates automatically as you type for instant feedback
  • Upload files to encode/decode larger datasets without copy-paste
  • Swap button quickly reverses conversion direction with same data
  • URL-safe variant prevents encoding issues in web URLs and filenames

Most Popular

Most users prefer Standard Base64 with padding for APIs and data transmission

When to Use This Tool

API Authentication & Data Transmission

Encode username:password combinations for HTTP Basic Authentication headers, or encode API tokens for safe transmission in HTTP requests. Base64 is the standard for encoding credentials in Authorization headers and for transmitting binary data over text-based protocols like JSON, XML, or HTTP. Essential for REST APIs, webhooks, and any system requiring text-safe data encoding.

Recommended: API Integration

Embedding Binary Data

Convert images, fonts, or files to Base64 for embedding directly in HTML, CSS, or JSON without external file references. Create data URIs (data:image/png;base64,...) to embed small images or icons inline, reducing HTTP requests and simplifying deployment. Perfect for email templates, single-page applications, or offline-capable web apps where external resources are impractical.

Recommended: Web Development

Data Storage & Email Attachments

Store binary data in text-only databases, configuration files, or environments variables. Encode email attachments using MIME Base64 format for transmission over SMTP. Essential for systems where binary storage is restricted, such as JSON databases, environment configs, or legacy text-based protocols that don't support raw binary data.

Recommended: Data Management

How It Works

1

Choose Encode or Decode mode using the toggle buttons at the top

2

Select Base64 variant: Standard (most common), URL-safe (web), or MIME (email)

3

Optionally enable/disable padding (= characters) based on your requirements

4

For MIME or large output, enable line breaks for better readability

5

Type or paste your text (encode) or Base64 string (decode) in the input field

6

The tool automatically converts as you type with live preview

7

For encode: Text is converted to UTF-8 bytes, then grouped into 3-byte chunks

8

Each 3-byte chunk (24 bits) is divided into four 6-bit values (0-63)

9

Each 6-bit value is mapped to one of 64 Base64 characters (A-Z, a-z, 0-9, +/)

10

Padding (=) is added if needed to make output length a multiple of 4

11

For decode: Base64 characters are converted back to 6-bit values

12

Four 6-bit values are combined into three 8-bit bytes (24 bits total)

13

Bytes are interpreted as UTF-8 text for display

14

Whitespace and line breaks are automatically removed during decoding

15

Use swap button to reverse direction and convert output back to original

16

All processing happens in browser - your data never leaves your device

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Client-side JavaScript with custom Base64 implementation supporting Standard, URL-safe, and MIME variants for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

What is Base64 encoding and how does it work?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It works by taking groups of 3 bytes (24 bits) and dividing them into 4 groups of 6 bits each. Each 6-bit group (0-63) is mapped to one of the 64 characters. This makes binary data safe for text-based systems but increases size by ~33%.

What's the difference between Standard, URL-safe, and MIME Base64?

Standard Base64 uses +, / and = for encoding. URL-safe Base64 replaces + with - and / with _ (and typically omits padding =) to make it safe for URLs and filenames. MIME Base64 is standard Base64 with line breaks every 76 characters for email compatibility (RFC 2045). Use standard for general purposes, URL-safe for web URLs/filenames, and MIME for email attachments.

Is Base64 encryption or secure?

No! Base64 is NOT encryption and provides NO security. It's simply an encoding format that makes binary data text-safe. Anyone can easily decode Base64 data - it's completely reversible with no key required. Never use Base64 alone to protect passwords, API keys, or sensitive data. For security, use proper encryption (AES, RSA) then optionally Base64-encode the encrypted result.

Why does Base64 increase file size?

Base64 encoding increases data size by approximately 33% because it represents every 3 bytes of binary data using 4 ASCII characters. This overhead comes from using only 64 out of 256 possible byte values to ensure text-safety. For example, a 3KB file becomes 4KB after Base64 encoding. This trade-off is acceptable when text-only transmission is required.

What is padding (=) and do I need it?

Padding (= characters) is added at the end to make the output length a multiple of 4. Standard Base64 requires padding for proper decoding. URL-safe Base64 often omits padding since decoders can infer the original length. Enable padding for strict RFC compliance and maximum compatibility. Disable for shorter URLs or when both encoder and decoder agree to omit it.

When should I use line breaks?

Use line breaks (MIME format) for email attachments or when storing Base64 in text files for human readability. MIME Base64 adds a line break (CRLF) every 76 characters per RFC 2045. For APIs, URLs, or JSON, don't use line breaks - keep it as a single continuous string. The decoder automatically handles both formats by stripping whitespace.

Can I encode any type of data?

Yes! Base64 can encode any binary data - text, images, videos, PDFs, executables, or raw bytes. When encoding text, the tool converts it to UTF-8 bytes first. When decoding, it interprets the result as UTF-8 text. For non-text binary data, use file upload to preserve exact bytes without text interpretation. Base64 is commonly used for images, fonts, and small files.

Is my data secure using this tool?

Absolutely! All encoding and decoding happens entirely in your browser using JavaScript. Your data is never sent to any server, uploaded anywhere, or stored remotely. Everything runs 100% locally client-side, ensuring complete privacy for sensitive data like API keys or credentials. Remember: Base64 is encoding, not encryption - it doesn't provide security, only format conversion.