DevPik Logo

Base64 Encoder / Decoder

Encode text or binary data to Base64 or decode Base64 strings back to text. Handles UTF-8, emoji, Base64URL (JWT-style), and data URIs entirely in your browser.

Why Use Base64 Encoder / Decoder?

Base64 is the lingua franca of "binary data in a text-only world" — JWT payloads, HTTP Basic auth headers, CSS data URIs, email attachments, and webhook signatures all use it. When you're debugging an API response or pulling apart a token, you need to peek at the decoded value quickly, and you definitely don't want to paste a potentially-sensitive string into a random online form. Running Base64 in the browser keeps everything local: your access keys and tokens stay on your machine.

How to Use Base64 Encoder / Decoder

  1. Enter or paste the text you want to encode in the input field.
  2. Click 'Encode' to convert your text to Base64 format, or paste a Base64 string and click 'Decode' to convert it back to readable text.
  3. Copy the result with the copy button. The tool handles UTF-8 text correctly.

Worked Examples

Encoding HTTP Basic auth credentials

Input
Encode: demo-user:S3cretPass!
Output
ZGVtby11c2VyOlMzY3JldFBhc3Mh

Prefix with "Basic " and paste into the Authorization HTTP header.

Decoding a JWT header

Input
Decode: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
Output
{"alg":"HS256","typ":"JWT"}

JWT header and payload segments are Base64URL-encoded — this tool handles both standard and URL-safe variants.

Encoding UTF-8 text with emoji

Input
Encode: Deploy shipped 🚀
Output
RGVwbG95IHNoaXBwZWQg8J+agA==

The encoder uses UTF-8 byte representation, so emoji and accented characters round-trip correctly.

About Base64 Encoder / Decoder

Base64 encoding is a binary-to-text encoding scheme that converts binary data into a printable ASCII string using 64 characters (A-Z, a-z, 0-9, +, /). The Base64 Encoder/Decoder converts text to and from Base64 encoding instantly. It represents binary data in an ASCII string format, widely used in web development, email protocols (MIME), data URLs, and API authentication. Developers use Base64 to embed images in CSS/HTML (data URIs), encode API credentials for HTTP Basic Authentication, transmit binary data through text-only channels, and encode/decode JWT token payloads. Our tool handles UTF-8 text correctly, ensuring that international characters, emojis, and special symbols are properly encoded and decoded. All processing happens client-side for security.

Troubleshooting & Common Issues

Decoding gives garbled output or "Invalid character"

Check that the input is a complete Base64 string with no wrapping whitespace, line breaks, or trailing characters. The decoder strips common whitespace automatically but rejects invalid characters (anything outside A-Z, a-z, 0-9, +, /, =). If you're pasting from a JWT, use the Base64URL variant — standard Base64 treats '-' and '_' as invalid.

Encoded output is missing "=" padding

Padding equals signs are only added when the input byte-length isn't a multiple of 3. One trailing byte produces two '=' padding characters, two trailing bytes produce one '='. Some Base64URL variants omit padding entirely — both are valid and can be decoded.

Non-ASCII characters come back wrong after a round-trip

Make sure both the encoder and decoder interpret the bytes as UTF-8. If your source is ISO-8859-1 or Windows-1252 and the decoder assumes UTF-8, accented characters will corrupt. Convert source text to UTF-8 before encoding for safe cross-platform use.

I need Base64URL for a JWT or OAuth token, not standard Base64

Base64URL replaces '+' with '-' and '/' with '_', and omits padding. After encoding with this tool, run a search-and-replace (+ → -, / → _) and strip trailing '=' characters. The decoder tolerates both variants automatically.

Frequently Asked Questions

What is Base64 encoding used for?

Base64 is used to safely transmit binary data through text-based protocols. Common uses include embedding images in HTML/CSS, encoding email attachments (MIME), HTTP Basic Authentication headers, encoding JWT payloads, and storing binary data in JSON or XML.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can decode a Base64 string back to the original data without any key or password. Never use Base64 to protect passwords, API keys, or sensitive data — use proper encryption (AES, ChaCha20) or a secrets manager.

Why does Base64 increase file size?

Base64 encoding increases data size by approximately 33% because it represents every 3 bytes of binary data as 4 ASCII characters. This trade-off is accepted for the convenience of text-safe transmission across channels that can't handle raw bytes.

What is the maximum size for Base64 encoding?

There's no hard protocol limit, but practical limits depend on where the encoded value is used. Data URIs embedded in CSS should stay under 50KB for performance; HTTP headers should stay under a few kilobytes; JWTs are typically under 8KB. For large files, prefer a direct binary upload instead of embedding Base64.

Why is Base64 used in data URIs?

Data URIs (data:image/png;base64,…) let you embed an image, font, or other binary asset directly in HTML or CSS without a separate HTTP request. Base64 is used because data URIs must be text-safe. It's a performance trade-off — fewer network requests at the cost of larger source files and zero caching of the asset.

What's the difference between Base64 and Base64URL?

Base64URL is a URL-safe variant that replaces '+' with '-' and '/' with '_', and usually omits the trailing '=' padding. This makes the encoded string safe to use in URLs, filenames, and HTTP headers. JWTs and many OAuth tokens use Base64URL. This tool accepts both variants when decoding.

Is my text sent to a server when I use this tool?

No. The Base64 encoder and decoder run entirely client-side in your browser. Your input never leaves your device, making the tool safe for tokens, API keys, session cookies, and other sensitive data you might encounter while debugging.

Related Tools

Was this tool helpful?