Base64 Encode/Decode

Encode or decode Base64 instantly in your browser — auto-detects whether you pasted plain text or Base64, so there's no mode switch to think about.

0 chars 0 Bytes

What Is Base64 Encoding?

Base64 is a way of representing binary data — or any text — using only 64 printable ASCII characters (A–Z, a–z, 0–9, +, /, with = for padding). It doesn't compress or encrypt anything; it just re-packages bytes into a format that's safe to paste into places that only expect plain text, like an email body, a JSON field, or a CSS url().

Encoding turns readable text (or raw bytes) into that Base64 alphabet. Decoding reverses it, turning the Base64 string back into the original data.

At a Glance
Auto-detects direction Encodes or decodes automatically
64-character alphabet A–Z · a–z · 0–9 · + · /
~33% larger output The cost of a text-safe format

Why Use Base64?

Some systems — old email protocols, certain APIs, URL query strings, JSON documents — can't safely carry arbitrary binary bytes or every character a string might contain. Base64 sidesteps that by using a fixed, safe character set, at the cost of making the encoded output about 33% larger than the original.

How This Tool Works

Paste text or a Base64 string into the box below and click the button. This tool automatically detects which direction you need — if what you pasted decodes cleanly as valid Base64, it decodes it; otherwise, it encodes it. Everything happens in your browser; nothing is uploaded to any server.

Plain Text vs. Base64

FeaturePlain Text / BinaryBase64
Character setAnything, including raw bytes64 fixed ASCII characters + padding
SizeOriginal size~33% larger
Safe to paste into JSON, XML, URLsNot alwaysYes
Human readableYes (if text)No — looks like random characters
Common usesSource data, filesEmail attachments, data URLs, API tokens, config files

Keep Data as Plain Text/Binary When

  • It's already in a format the destination system accepts directly
  • File size matters and the ~33% overhead isn't worth it
  • The data needs to stay human-readable, like a log file

Encode to Base64 When

  • You need to embed binary data (an image, a font) directly inside CSS, HTML, or JSON
  • A system only accepts plain-text fields but you need to send binary data through it
  • You're constructing a Basic Auth header or a JWT segment by hand

Common Scenarios for Base64 Encoding/Decoding

Embedding Small Images in CSS or HTML

Instead of a separate HTTP request for a tiny icon, developers often embed it directly as a Base64 data: URL inside CSS or an <img src>. This tool encodes the raw data; if the image itself is still large before encoding, run it through our Image Compressor first so the resulting Base64 string doesn't bloat your stylesheet.

Reading a JWT or API Token by Hand

Many tokens and auth headers carry Base64-encoded segments. Pasting one in here decodes it back to readable text so you can inspect what's actually inside, without writing a script.

Debugging a Base64 API Payload

APIs sometimes return binary data (like a file or an image) as a Base64 string inside a JSON response. Decoding it here lets you quickly check whether the payload looks right before wiring up real code to handle it.

Constructing a Basic Auth Header

HTTP Basic Authentication sends credentials as username:password, Base64-encoded. Typing that pair in here gives you the exact header value to paste into a request or config file.

Sending Binary Data Through a Text-Only Field

Some config files, environment variables, or legacy systems only accept plain text. Encoding binary data to Base64 first lets it travel safely through fields that would otherwise mangle raw bytes.

Other Ways to Encode or Decode Base64

You can also encode or decode Base64 using your command line (base64 and base64 -d on Mac/Linux, or certutil -encode on Windows), or a short script in your language of choice — most have a built-in Base64 library. FileCast is useful for a quick, one-off conversion without opening a terminal.

Frequently Asked Questions

Is it safe to use this on sensitive data?

Yes. Encoding and decoding both happen entirely in your browser — nothing is uploaded to any server. That said, remember Base64 is not encryption: anyone who has the encoded string can decode it just as easily. Don't rely on it to keep secrets hidden.

How does the tool know whether to encode or decode?

It checks whether what you pasted is valid Base64 (the right character set, correct padding) and whether it decodes to readable UTF-8 text. If both are true, it decodes; otherwise, it treats your input as plain text and encodes it.

Can I force it to always encode, even if my text looks like Base64?

Not directly — the tool always auto-detects. If your plain text happens to look exactly like valid Base64 (e.g. it's only letters, numbers, +, /, and padding), it may be decoded instead of encoded. In that edge case, add a character outside the Base64 alphabet (like a space or punctuation) and it will encode as expected.

Does this handle Unicode text, like emoji or non-English characters?

Yes. Text is encoded as UTF-8 bytes before Base64 encoding, and decoded output is interpreted as UTF-8, so accented characters, emoji, and non-Latin scripts all round-trip correctly.

What's the difference between this and "Base64 URL-safe" encoding?

Standard Base64 uses + and /, which aren't safe inside URLs without additional escaping. This tool produces standard Base64. If you need the URL-safe variant (used by JWTs, which replaces +// with -/_ and drops padding), see our JWT Decoder for that specific format.