Base64 Decoder/Encoder

🔐 Base64 Encoder / Decoder
📝 INPUT 0 chars | 0 lines
⚙️ SETTINGS
📤 OUTPUT 0 chars | 0 lines
Output will appear here...
📊 INFORMATION
0
Input Size (bytes)
0
Output Size (bytes)
0
Size Ratio
ℹ️ What is Base64?
Base64 encoding converts binary data to ASCII text. Commonly used for emails, URLs, and embedding images in HTML/CSS.
💡 Tips:
• Use "Auto-detect" to automatically identify input type
• URL-safe mode for web-safe encoding
• Supports Unicode (UTF-8) and ASCII

A developer sets up HTTP Basic authentication for an API and needs to check whether the Authorization header is formatted correctly. The header carries the username and password as a Base64-encoded string. Without a quick decoder right there in the browser, confirming the value requires writing a one-liner in a terminal or opening a separate tool. Another developer receives a JWT token from an auth service and needs to read the payload claims to confirm the user roles are being passed correctly. The payload is Base64url encoded. Neither task needs a complex tool, but both need a fast, reliable one that handles standard Base64 and the URL-safe variant.

Base64 encoding converts binary or text data into a set of 64 printable ASCII characters, making it safe to transmit through systems built for text. Emails, API headers, JSON payloads, HTML data URIs, and JWT tokens all rely on it. This encoder and decoder handles both directions, in-browser, with no data sent to any server.

How It Works

  1. Choose your mode and paste input by selecting Encode (text to Base64) or Decode (Base64 to text) from the mode toggle. Type or paste your content into the input panel. Enable Auto-detect if you are unsure whether the input is already Base64 or plain text; the tool identifies the format and selects the correct operation automatically. The input panel shows character count and line count in real time as you type.
  2. Configure encoding settings as needed. Select the character set: UTF-8 handles any Unicode text including non-Latin scripts, accented characters, and emoji; ASCII is appropriate when the input is strictly 7-bit ASCII data. Enable URL-safe Base64 to replace the standard + and / characters with - and _ respectively, which prevents parsing errors when the output will be used in URLs, query parameters, or JWT tokens. Enable Add Line Breaks to wrap the encoded output at 76-character intervals, which is required by MIME email format. The Information panel shows input size in bytes, output size in bytes, and the size ratio, confirming the expected ~33% overhead that Base64 encoding adds.
  3. Copy or swap the output from the output panel. The Swap button exchanges the input and output fields, useful for round-trip testing where you encode text, verify the result, then swap and decode to confirm the output matches the original input. Clear removes all content from both panels to start fresh.

Compatibility & Support

Supported Input and Output

  • Encode input: Any plain text in UTF-8 (supports all Unicode characters) or ASCII
  • Decode input: Any valid Base64 or Base64url-encoded string
  • Output modes: Standard Base64 (RFC 4648), URL-safe Base64 (RFC 4648 Section 5), MIME-formatted Base64 with 76-character line breaks
  • Character sets: UTF-8 (Unicode), ASCII

What This Tool Does Not Handle

Binary file encoding and decoding (images, PDFs, executables) are not supported directly through this text-based encoder. For Base64-encoded PDF data specifically, use the Base64 to PDF tool which decodes binary file payloads rather than text strings. Base64 encoding is not encryption and should never be used to protect sensitive data. Decoded output from this tool is always readable by anyone.

Data Size Considerations

All encoding and decoding runs in-browser using the browser's built-in btoa() and atob() functions, so no server size cap applies. The size ratio panel shows the real overhead: Base64 encoding increases data size by approximately 33 percent because every 3 bytes of input become 4 characters of output. Very large text inputs may produce proportionally large encoded outputs.

Who Should Use This Tool?

  • Students: A computer science student implementing HTTP Basic authentication in a class project can encode a "username:password" string to verify the correct Authorization header format before testing the API endpoint.
  • Freelancers & Designers: A web developer embedding a small logo in a CSS file as a data URI can encode the Base64 string for the image, verify it using Auto-detect mode, and paste it into the stylesheet without an external file request adding latency.
  • Office Professionals: A technical support analyst who receives a Base64-encoded configuration value from a vendor and needs to read the actual credential or parameter it contains can paste and decode it in seconds without installing any software.
  • Developers: A backend engineer debugging a JWT authentication flow can copy the header or payload section of a token, decode it with URL-safe mode enabled, and read the JSON claims to confirm the token contains the expected user roles and expiration time.

Key Features

Here's what separates this tool from generic alternatives:

🔒

No Server Upload

The browser's native btoa() and atob() functions handle all encoding and decoding locally. API keys, auth tokens, credentials, and configuration values never leave your browser during the conversion.

🔗

URL-Safe Base64 Mode

Replaces + with - and / with _ to produce strings safe for URLs, query parameters, and JWT tokens. Standard Base64 uses characters that break URL parsing without this substitution, making URL-safe mode essential for web and API work.

🔍

Auto-Detect Input Mode

Automatically identifies whether the pasted content is plain text or a Base64 string and selects the correct operation. Saves the guessing step when working with content from unknown sources or mixed-format logs.

📧

MIME Line Break Option

Add line breaks every 76 characters to produce MIME-compliant Base64 output for email encoding. Email protocols require wrapped output; standard Base64 without line breaks is rejected by many mail servers.

📊

Size Ratio Display

The Information panel shows input size, output size, and size ratio in real time. Confirms the expected ~33% overhead and helps estimate whether embedding Base64 data inline is worth the payload size increase for a specific use case.

🔄

Swap for Round-Trip Testing

The Swap button exchanges input and output in one click. Encode text, verify the Base64 output, swap, and decode to confirm the round trip restores the original value exactly. Essential for verifying encoding correctness.

Why This Tool Beats the Alternatives

  • No account, email, or signup required at any point.
  • No server upload; credentials, tokens, and configuration values stay in the browser throughout.
  • URL-safe Base64 mode for JWT and URL encoding in the same interface as standard Base64, no separate tool needed.
  • Auto-detect mode identifies input type automatically rather than requiring the user to always know whether the input is encoded or plain text.
  • MIME line break option for email-compatible encoding, which most basic encoder tools do not expose as a setting.
  • Size ratio display shows the encoding overhead in real time, useful for making informed decisions about inline data embedding.

Pro Tips

  • When decoding JWT tokens, only the header (first section before the first dot) and payload (second section between the two dots) are Base64url encoded. The third section is the signature and is not meaningful to decode as text. Enable URL-safe mode before decoding each section, and the decoded JSON becomes immediately readable without any further processing.
  • For HTTP Basic Auth, the format is always username:password (colon-separated, no spaces). Encode that exact string in UTF-8 mode, then prepend "Basic " (with a space) to the encoded result for the full Authorization header value. Confirming this with the encode then decode swap cycle before using it in an API call catches format errors before they reach the server.
  • If your decoded output appears as garbled characters instead of readable text, the source data was likely encoded using ASCII rather than UTF-8. Switch the character set to ASCII and decode again. The reverse is also common: text that includes accented or Unicode characters must be encoded as UTF-8 to preserve them correctly after a round trip.

Paste your text or Base64 string, select the mode, and get the result instantly. For working specifically with Base64-encoded PDF files from API responses or data URIs, the Base64 to PDF tool handles binary PDF decoding in the same browser-based workflow.

Frequently Asked Questions