Base64 Encoder / Decoder

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts any data — text, images, files — into a string of printable ASCII characters. It uses a 64-character alphabet (A-Z, a-z, 0-9, +, /) to safely represent binary data in text-based formats like JSON, XML, HTML, and email. The encoded output is roughly 33% larger than the original data.

Common Use Cases

Data URIs — embed small images directly in CSS or HTML to reduce HTTP requests. API payloads — encode binary attachments in JSON requests. Email — MIME encoding uses Base64 for attachments. URL parameters — safely pass binary data through URLs.

How to Use This Base64 Tool

  1. Paste text or pick a file — Type or paste text to encode, paste a Base64 string to decode, or switch to File to encode any file.
  2. Select the operation — Choose Encode to convert text to Base64, or Decode to convert Base64 back to readable text.
  3. Choose the variant — Standard Base64, or URL-Safe (replaces + and / with - and _ and drops the = padding). For files, Data URI adds the data: prefix.
  4. Copy the result — Click Copy to grab the encoded or decoded output.

Worked example: what this tool actually outputs

On October 12, 2026 we ran the tool's own encode and decode functions (copied from this page) in Node 22, then confirmed the edge cases on this page in Chromium. Text is encoded as UTF-8 first, which is what makes non-ASCII input work: plain btoa() throws on any character above U+00FF.

InputBytes (UTF-8)Standard outputURL-safe output
RFC 4648 test vectors f, fo, foo, foobar1, 2, 3, 6Zg== Zm8= Zm9v Zm9vYmFypadding removed: Zg Zm8 Zm9v Zm9vYmFy
café5Y2Fmw6k=Y2Fmw6k
👍48J+RjQ==8J-RjQ
???3Pz8/Pz8_

All seven RFC 4648 section 10 test vectors match exactly. Decoding goes through the browser's atob(), which follows the WHATWG forgiving-base64 rules:

Pasted into DecodeResult
SGVsbG8 (no padding)Hello: missing = is accepted
SGVs + line break + bG8=Hello: spaces and line breaks (MIME-wrapped text) are ignored
data:text/plain;base64,SGk=Hi: a data: prefix is stripped
SGVsbG8==Error: one = too many
Pz8_ with URL-Safe off??? in either setting: Decode now accepts both alphabets
Y2Fm6Q== (Latin-1 bytes for café)The 4 bytes 63 61 66 e9, shown as hex (not valid UTF-8) with a download button
iVBORw0KGgo= (the first 8 bytes of a PNG)89 50 4e 47 0d 0a 1a 0a, recognised as a PNG and downloadable as decoded.png

Frequently Asked Questions

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 safely in text-based protocols like email and URLs.
When should I use Base64?
Use Base64 for embedding small images in CSS/HTML (data URIs), encoding binary data for JSON/XML payloads, passing data through URL parameters, or encoding email attachments. Avoid it for large files since it increases size by about 33%.
Does Base64 encrypt data?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string. It is designed for data transport, not security. For actual encryption, use cryptographic methods like AES.
When should I use Base64 encoding?+
Use Base64 for embedding small images in HTML/CSS (data URIs), encoding email attachments (MIME), transmitting binary data in JSON APIs, encoding data in URL parameters (URL-safe variant), and storing binary data in text-only databases or configs.
What is the difference between Base64 and Base64URL?+
Standard Base64 uses + and / characters, which have special meaning in URLs. Base64URL replaces + with - and / with _ to make encoded strings URL-safe without additional percent-encoding. JWTs use Base64URL encoding for this reason.

📖 Learn More

Related Article How to Encode & Decode Base64 for Web Development →

Built by Derek Giordano · Part of Ultimate Design Tools

Privacy Policy · Terms of Service