Developer

Base64 Encoder/Decoder

Paste any text to encode it as Base64, or paste a Base64 string to decode it back to plain text — instant & in-browser.

Did this calculator help you?

What is Base64 Encoder/Decoder?

Base64 is a binary-to-text encoding scheme defined in RFC 4648 that converts any binary data into a safe ASCII string using a 64-character alphabet: uppercase A–Z (0–25), lowercase a–z (26–51), digits 0–9 (52–61), plus the symbols + (62) and / (63). The equals sign (=) is used as padding when the input length is not a multiple of three bytes. Base64 is widely used for embedding images in HTML and CSS, transmitting binary attachments over email (MIME), encoding data URLs for inline media, and passing binary payloads through text-only APIs and protocols. Because every three input bytes map to exactly four output characters, the encoded representation is roughly 33% larger than the original. This tool performs standard Base64 encoding and decoding entirely in your browser, supporting full UTF-8 input so international text, emoji, and special characters encode correctly without server round-trips.

When to Use This Calculator

  • When embedding binary data like images, audio, or PDFs into JSON API payloads or HTML pages
  • When sending file attachments through email protocols (MIME) that only support plain text
  • When building authentication systems that use Basic Auth with base64-encoded credentials
  • When encoding data for transmission over protocols that only support ASCII text (e.g., XML, SOAP)
  • When you need to store binary data in a text-based database or configuration file
  • When debugging or inspecting encoded payloads from API requests or email attachments

Steps:

  1. Paste or type your text into the input area, or upload a file for direct encoding.
  2. Choose Encode or Decode mode using the mode toggle buttons.
  3. Enable Batch mode if you need to process multiple values at once, then select a separator.
  4. Click the Convert button and the output area will update in real time.
  5. Copy the result to your clipboard with the copy button or download it for later use.

Formula

Encoding: Binary data → 6-bit groups → Base64 alphabet (A-Z, a-z, 0-9, +, /) ➡ Decoding: Reverse the process

Use Cases

  • Embedding images or fonts inline in HTML, CSS, or SVG files via data URLs
  • Encoding binary file attachments for transport through email protocols (MIME)
  • Building Basic HTTP Authorization headers that pass credentials as Base64
  • Storing binary data like encryption keys or certificates in JSON or XML configuration files
  • Transmitting binary payloads through text-only APIs, REST endpoints, or message queues
  • Debugging protocol buffers, JWT tokens, or webhook payloads that contain Base64-encoded segments

Key Benefits

  • Instant encoding and decoding with real-time output as you type
  • Full UTF-8 support so international text and emoji encode correctly
  • Batch mode lets you encode or decode multiple strings separated by lines or commas
  • File upload converts any file to Base64 directly in your browser with no server upload
  • One-click copy button for quick use of the result in code or configuration
  • Privacy-first: all processing happens locally — nothing is sent to any server

Pro Tips

  • Use URL-safe Base64 (replacing + with - and / with _) when embedding encoded data in URLs or file paths
  • Compress data before Base64 encoding if payload size matters — encoding alone adds roughly 33% overhead
  • Always verify the input charset matches the expected encoding before decoding, especially with non-ASCII text
  • For email attachments, use the MIME content-transfer-encoding header with Base64 to ensure cross-client compatibility
  • Batch mode is useful for encoding multiple values at once — use newline or comma separators depending on your data format

Common Mistakes to Avoid

  • Assuming Base64 provides security or confidentiality — it is a reversible encoding, not encryption
  • Forgetting that Base64 increases data size by ~33%, which can exceed API or storage limits
  • Mixing up standard Base64 and URL-safe Base64, which use different special characters (+, / vs -, _)
  • Treating the equals sign (=) as literal data rather than padding — it is not part of the encoded content

Key Terms Explained

Base64: Binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters
Encode: Convert raw text or binary data into a Base64 string for safe transport over text-based systems
Decode: Reverse the Base64 encoding to recover the original bytes or text from an encoded string
UTF-8: Variable-width Unicode character encoding that supports every character in the Unicode standard
Padding: The equals sign (=) characters added to the end of a Base64 string to make its length a multiple of four

Related Concepts

Example

Encoding "Hello World!" → "SGVsbG8gV29ybGQh". Decoding "U3Vuc2hpbmU=" → "Sunshine". Each 3 bytes of input become 4 Base64 characters.

Interpreting Your Results

The converter works in two modes: Encode (text to Base64) and Decode (Base64 to text). When encoding, the output is always a valid Base64 string using the characters A–Z, a–z, 0–9, +, and /. When decoding, paste a valid Base64 string and the tool will return the original text or binary data. The byte count output shows how much data you're working with — this is useful for understanding the size overhead. Base64 encoding increases data size by about 33%, so a 100-byte file becomes 133 bytes when encoded. If you need to minimize payload size, consider compressing the data before encoding, or use a more efficient encoding scheme for your use case.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in ASCII string format. It is commonly used for transmitting data over media designed for text, such as embedding images in HTML or email attachments.
When should I use Base64?
Use Base64 when you need to embed binary data (images, files) in text-based formats like JSON, HTML, CSS, XML, or email. It is also used for basic data obfuscation and API authentication headers.
Does Base64 compress data?
No, Base64 actually increases data size by approximately 33%. It encodes 3 bytes of data into 4 ASCII characters. Use compression before Base64 if file size matters.
What is Base64 encoding?
Base64 encoding converts binary data into ASCII text using 64 printable characters (A-Z, a-z, 0-9, +, /). It's commonly used to embed images in HTML/CSS, transmit data over text-based protocols, and store binary data in JSON.
Is Base64 encoding secure?
No, Base64 is NOT encryption — it's simply an encoding scheme. Anyone can decode Base64 strings easily. Never use Base64 to protect sensitive data like passwords or API keys. Use proper encryption (AES, RSA) for security.
Why are my Base64 strings different from other tools?
Different tools may use different line wrapping (76 chars per line is standard for MIME), padding characters (=), or character sets. Our tool uses standard RFC 4648 encoding without line breaks, which is most common for web development.
Can I decode a Base64 string back to the original?
Yes! Base64 encoding is fully reversible. Use the decode mode to convert any valid Base64 string back to its original form — text, binary, or any data type.
What's the difference between Base64 and URL-safe Base64?
Standard Base64 uses + and / characters, which have special meanings in URLs. URL-safe Base64 replaces these with - and _ to make the encoded string safe for use in URLs and file names without additional encoding.
When should I use Base64 encoding?
Use Base64 when you need to embed binary data in text formats (HTML, CSS, JSON, XML), transmit binary data over text-only protocols (email, HTTP), store binary data in databases that only handle text, or display binary data as readable text.
Does Base64 encoding increase file size?
Yes, Base64 encoding increases data size by approximately 33%. Every 3 bytes of binary data becomes 4 ASCII characters. For example, a 1MB file becomes about 1.33MB when Base64 encoded.
Can Base64 handle Unicode text?
Base64 encodes raw bytes, not characters. To encode Unicode text, first convert it to bytes (typically UTF-8), then Base64-encode the bytes. Our tool handles this conversion automatically.

Discover More Tools

Fresh picks from across our tool library.