πŸ”

Base64 Encoder/Decoder

Encode and decode Base64 strings, files, and images. Perfect for developers, API testing, and data URIs.

⚑ Instant Conversion πŸ”’ Privacy First πŸ’» Developer Friendly

Use the Base64 Encoder/Decoder

Input Type

Input Text

0 characters

Output (Base64)

0 characters

Quick Examples

πŸ’‘ About Base64

πŸ”

What is Base64?

Encoding scheme to represent binary data in ASCII text format

πŸ’»

Common Uses

Data URIs, API requests, email attachments, JWT tokens

🌐

Web Safe

Safely transmit data over text-based protocols

πŸ“Š

Size Increase

Base64 encoded data is ~33% larger

πŸ’‘ Pro Tips

  • Base64 is NOT encryption - data is easily decoded
  • Perfect for embedding small images in HTML/CSS
  • Used in data URIs: data:image/png;base64,...
  • Common in JWT tokens and API authentication
  • Safe for URLs and email transmission

🎯 Use Cases

  • Encode images for data URIs
  • API request/response payloads
  • Email attachments (MIME)
  • Store binary data in JSON
  • Embed fonts and files in CSS

Base64 Encoding & Decoding Use Cases

πŸ” Base64 Encode for API Authentication

Encode credentials for Basic Authentication headers. Convert username:password to Base64 for API requests, REST endpoints, and HTTP authentication. Essential for developers testing APIs and webhooks.

πŸ–ΌοΈ Convert Image to Base64 Data URI

Embed images directly in HTML, CSS, or JSON. Convert images to Base64 strings for email templates, CSS backgrounds, or inline SVG. Eliminates external image requests and improves page load speed.

πŸ“„ Encode Files for Email Attachments

MIME email attachments use Base64 encoding. Convert files to Base64 for programmatic email sending, API file uploads, or data transmission. Works with PDFs, images, and documents.

πŸ”— Base64 URL Safe Encoding

Encode data for URLs and query parameters. Base64 makes binary data URL-safe by replacing special characters. Perfect for passing encrypted tokens, session data, or binary content in URLs.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into ASCII characters. It uses 64 characters (A-Z, a-z, 0-9, +, /) to represent data, making it safe for transmission in text-based systems like email, JSON, and URLs.

Why Use Our Base64 Tool?

  • βœ… Bidirectional: Encode text to Base64 or decode Base64 back to text
  • βœ… File Support: Encode/decode images, PDFs, and any file type
  • βœ… Real-Time: Instant encoding/decoding as you type
  • βœ… No Upload: All processing in your browserβ€”100% private
  • βœ… Developer Friendly: Perfect for API testing and debugging
  • βœ… Copy to Clipboard: One-click copy of encoded/decoded results

What Base64 Is β€” and What It Isn't

Base64 is a way to represent any binary data using only 64 safe, printable characters: A–Z, a–z, 0–9, + and / (with = for padding). It exists because many systems β€” email, JSON, XML, URLs, HTTP headers β€” were designed to carry text, and raw binary bytes passing through them get corrupted or rejected. Base64 takes every 3 bytes of input and spreads them across 4 text characters, which is why encoded output is always about 33% larger than the original.

The crucial thing Base64 is not: encryption. It provides zero secrecy β€” anyone can decode it instantly, as this page demonstrates. If you see Base64 used to "hide" passwords or API keys, that's a security bug, not a security measure. Encoding is about transport safety, never about confidentiality.

Where You'll Meet Base64 in Real Work

Data URIs. Small images embedded directly in HTML or CSS as data:image/png;base64,iVBORw0... save an HTTP request. Great for icons under a few KB; counterproductive for large images because of the 33% size penalty.

HTTP Basic Auth. The Authorization: Basic header is just username:password Base64-encoded β€” readable by anyone who sees the header, which is why Basic Auth is only acceptable over HTTPS.

JWTs and API payloads. JSON Web Tokens are three base64url-encoded segments; decoding them is how you debug auth issues (our JWT Decoder automates it). APIs also wrap binary attachments β€” PDFs, images, certificates β€” in Base64 to fit them inside JSON.

Email attachments. Every attachment you've ever sent traveled as Base64 inside the MIME message β€” it's the reason a 10 MB attachment counts as ~13 MB against a mailbox limit.

Encoding Text: the UTF-8 Detail That Bites

Base64 operates on bytes, but text has to become bytes first β€” and the encoding used matters. "cafΓ©" in UTF-8 is five bytes; in Latin-1 it's four; the Base64 differs accordingly. JavaScript's legacy btoa() throws on any character outside Latin-1 (the infamous "InvalidCharacterError" with emoji), which is why proper tools β€” including this one β€” encode the text as UTF-8 bytes before applying Base64. If a decoded string comes out as mojibake like café, the encoder and decoder disagreed about the character encoding, not about the Base64.

Frequently Asked Questions

Is Base64 secure for passwords or secrets?

No β€” it's reversible by anyone in milliseconds. Use real encryption for secrecy and hashing (see our Hash Generator) for integrity. Base64 only makes data transport-safe.

Why does my decoded output look like garbage?

Either the input wasn't valid Base64 (check for truncation or missing padding), or the decoded bytes aren't text at all β€” decoding a Base64-encoded image produces binary data, which renders as gibberish when displayed as text.

What are the = signs at the end?

Padding. Base64 works in blocks of 3 input bytes; when the input length isn't a multiple of 3, one or two = characters pad the final block. Some variants (like the base64url used in JWTs) omit padding entirely.

What's the difference between Base64 and base64url?

Standard Base64 uses + and /, which break inside URLs. Base64url swaps them for - and _ so tokens and parameters survive URLs unchanged. If a JWT segment fails to decode, this is usually why. For URL parameter encoding itself, use the URL Encoder.

Is my text sent to a server?

No β€” encoding and decoding run entirely in your browser, so tokens, credentials, and payloads you paste here stay on your machine.