Base64 Encoder / Decoder

Instantly encode or decode Base64 strings in your browser. Supports full Unicode including Japanese and emoji. Switch between standard and URL-safe Base64 (replaces + with - and / with _).

Free online tool to encode text to Base64 or decode Base64 strings back to text. Supports Unicode, Japanese, emoji, and URL-safe Base64.

No history yet

How to Use

Follow these steps to encode or decode Base64 strings.

  1. Select either "Encode" or "Decode" mode.
  2. If you need a URL-safe format (safe for URLs and filenames), check the "URL-safe" checkbox.
  3. Paste your text (for encoding) or your Base64 string (for decoding) in the input field.
  4. Click the "Convert" button to see the result.
  5. Use the copy button to copy the result to your clipboard.

All processing happens in your browser. Your input is never sent to any external server.

What Is Base64? How It Works

Base64 is an encoding scheme that represents binary data using only printable ASCII characters. It uses 64 characters: A–Z, a–z, 0–9, plus "+" and "/". Data is split into 6-bit chunks, and each chunk is mapped to one of these 64 characters. The encoded output is about 33% larger than the original, but Base64 is widely used to transmit binary data over protocols that only handle ASCII text, such as email (MIME) and HTTP.

URL-safe Base64 is a variant that replaces "+" with "-" and "/" with "_". The original characters have special meanings in URLs and would need to be percent-encoded (%2B, %2F). URL-safe Base64 can be embedded in URLs, cookies, and filenames without any escaping. It is used in JWT (JSON Web Token) payloads and Google OAuth tokens.

Note that Base64 is encoding, not encryption. It does not protect your data from unauthorized access. If security is required, combine it with an encryption algorithm such as AES.

Common Use Cases for Base64

Base64 encoding appears across web development, infrastructure, and security. Wherever binary data needs to travel safely through text-only channels, Base64 is the go-to solution. Here are the most common scenarios in detail.

HTTP Basic Authentication
HTTP Basic Auth encodes the string "username:password" in Base64 and sends it in the Authorization header as "Basic <encoded string>". Note that Base64 is not encryption — without HTTPS, anyone can decode it instantly. You can verify this yourself by decoding an Authorization header value with this tool.
Inspecting JWT (JSON Web Token) Payloads
A JWT consists of three URL-safe Base64 segments separated by dots: header, payload, and signature. Decoding the payload reveals claims such as user ID, roles, and expiration time (exp). Enable the "URL-safe" option in this tool and paste the middle segment of any JWT to read its contents — a common technique for debugging authentication issues during development.
Data URI Scheme (Inline Images in HTML / CSS)
Small icons or background images can be Base64-encoded and embedded directly as "data:image/png;base64,<data>" in HTML src attributes or CSS background-image properties. This eliminates extra HTTP requests and can speed up page loads. However, because Base64 adds roughly 33% overhead, this technique works best for small assets; large images should be served as separate files.
Email Attachments (MIME Encoding)
Email protocols were originally designed to carry only ASCII text, so binary files (PDFs, images, etc.) must be Base64-encoded before being attached. This is handled automatically by mail clients under the hood — you can see it in the raw message source as "Content-Transfer-Encoding: base64" followed by the encoded content.
Debugging API Responses
REST and GraphQL APIs frequently return binary data — images, PDFs, audio — as Base64 strings inside JSON fields. Paste the value here to decode it and verify the content without writing any code. You can also encode a file to Base64 to manually craft API request bodies that expect binary data as a string field.
Kubernetes Secrets and CI/CD Environment Variables
Kubernetes Secret resources store sensitive values such as passwords and certificates in Base64-encoded form inside YAML manifests (e.g., `echo -n 'password' | base64`). Similarly, CI/CD pipelines often Base64-encode certificate files or SSH keys before storing them as environment variables. This tool lets you encode or verify such values directly in the browser without a terminal.
Embedding Web Fonts in CSS
Web fonts (woff2, ttf, etc.) can be Base64-encoded and inlined in a CSS @font-face src rule as a data URI, removing the need for a separate font file request. Because font files are typically tens to hundreds of kilobytes — and Base64 adds another 33% — this approach is best suited for small icon fonts or standalone pages where eliminating HTTP round-trips is a priority.

As these examples show, Base64 is a versatile tool across many disciplines. The key trade-off is always the same: Base64 increases data size by roughly 33%. For large payloads, consider alternatives such as binary transfer, multipart form data, or dedicated file upload endpoints to avoid unnecessary memory and bandwidth overhead.

Frequently Asked Questions

Q. Can I encode Japanese text or emoji?
Yes. This tool encodes text as UTF-8 bytes before converting to Base64, so Japanese, Chinese, emoji, and other multibyte characters are all handled correctly.
Q. What is the difference between standard and URL-safe Base64?
Standard Base64 uses "+" and "/", which have special meanings in URLs. URL-safe Base64 replaces these with "-" and "_" respectively, so the output can be used in URLs and filenames without percent-encoding.
Q. Is my input sent to a server?
No. All encoding and decoding is performed locally in your browser using JavaScript. Sensitive data can be processed safely.
Q. Why does decoding fail?
Decoding can fail if the Base64 string contains invalid characters or if the length is not a multiple of 4 (missing padding). If the string uses "-" and "_" instead of "+" and "/", make sure to check the "URL-safe" checkbox.

URL Encode / Decode

For encoding and decoding Japanese characters or special symbols in URLs, our URL Encoder/Decoder tool is a great companion.

URL Encoder / Decoder