Skip to main content

Base64 Encode / Decode

Loading…

About Base64 Encode / Decode

The Base64 Encoder / Decoder converts text to Base64 encoding or decodes Base64 strings back to plain text instantly. Supports standard Base64 and URL-safe Base64 (replacing + with - and / with _). Handles Unicode text correctly using UTF-8 encoding.

Base64 is used to encode binary data as ASCII text for safe transmission in email (MIME), embedding images in HTML or CSS data URIs, encoding credentials in HTTP Basic Auth headers, storing binary data in JSON or XML, and passing data in URLs.

Everything runs entirely in your browser using the atob() and btoa() Web APIs. Your data never leaves your device.

Practical Uses for Base64 Encode / Decode

  • Embed a small image directly in HTML or CSS using a data URI
  • Encode credentials for an HTTP Basic Auth header
  • Decode a Base64 string found in an API response or JWT
  • Encode binary file data for safe storage in a JSON field
  • Generate a Base64 attachment payload for a MIME email
  • Decode a Base64-encoded environment variable or secret

How to Use Base64 Encode / Decode

  1. Paste your text or Base64 string into the input.

  2. Select Encode (text → Base64) or Decode (Base64 → text).

  3. Optionally enable URL-safe mode for use in URLs.

  4. Copy the result.

Examples

Example — Encode text
Input
Hello, World!
Output
SGVsbG8sIFdvcmxkIQ==
Example — Decode Base64
Input
SGVsbG8sIFdvcmxkIQ==
Output
Hello, World!
Example — Encode URL
Input
https://example.com/path?q=hello world
Output
aHR0cHM6Ly9leGFtcGxlLmNvbS9wYXRoP3E9aGVsbG8gd29ybGQ=
Example — Encode a Basic Auth header
Input
username:password
Output
dXNlcm5hbWU6cGFzc3dvcmQ=
Example — Decode a Kubernetes secret value
Input
cGFzc3dvcmQxMjM=
Output
password123

Who Uses the Base64 Encode / Decode Tool

  • Developers encode and decode API payloads, auth headers, and data URIs during debugging.
  • Backend engineers inspect Base64-encoded fields in JWTs, config files, and message queues.
  • DevOps and SREs decode Base64-encoded Kubernetes secrets and environment variables.
  • QA engineers verify that binary attachments or images are correctly encoded in API responses.
  • Students learn how binary-to-text encoding works for a computer science or networking course.

Comparisons

Base64 vs URL Encoding

Base64 and URL encoding solve different problems. Base64 converts arbitrary binary data into a compact ASCII representation, used for embedding images, encoding auth headers, and storing binary data in text formats.

URL encoding (percent-encoding) instead makes text safe to appear inside a URL by escaping characters like spaces and & that would otherwise break the URL's structure. They're sometimes combined: a Base64 string can itself need URL encoding if it contains + or / and is placed in a URL, which is exactly why Base64's URL-safe variant exists.

Base64 vs Encryption

Base64 is often mistaken for encryption, but it provides no security at all. It is a public, reversible encoding scheme — anyone can decode a Base64 string instantly with no key required.

Encryption transforms data using a secret key so that only someone with that key can recover the original content. If you need to protect sensitive data, use a real encryption algorithm like AES; use Base64 only when you need to represent binary data as text, not when you need to hide it.

Frequently Asked Questions

What is Base64 used for?

Base64 encodes binary or arbitrary data as printable ASCII text for safe transmission in systems that only handle text, such as email (MIME), HTTP headers, JSON, XML, and URLs.

Does it support URL-safe Base64?

Yes — URL-safe mode replaces + with - and / with _ so the output can be safely included in URLs and filenames without percent-encoding.

Does it handle Unicode and emoji?

Yes — text is encoded as UTF-8 before Base64 encoding, ensuring all Unicode characters including emoji are handled correctly.

Is Base64 encryption?

No — Base64 is encoding, not encryption. It does not provide any security. Anyone who sees a Base64 string can decode it instantly.

How do I embed an image in HTML using Base64?

Encode the image file as Base64, then use it as: <img src="data:image/png;base64,ENCODED_DATA_HERE">

Why is Base64 encoded data about 33% larger than the original?

Base64 represents every 3 bytes of data as 4 ASCII characters (4/3 ratio). This overhead is the trade-off for making binary data safe to transmit as text.

Can I use this to decode a Kubernetes secret?

Yes — Kubernetes stores secret values as Base64-encoded strings in manifests and 'kubectl get secret -o yaml' output. Paste the encoded value here to decode it back to plain text.

Why does my Base64 string end with = or ==?

The = characters are padding, added when the input length isn't a multiple of 3 bytes. Padding ensures the encoded output length is always a multiple of 4 characters, which some decoders require.

Can I encode a file, not just text?

This tool encodes and decodes text input. For encoding actual binary files (images, PDFs), that's typically done in code, though the resulting Base64 string can be decoded back here if it represents text-based content.