DEV Community

Sumit Kumar
Sumit Kumar

Posted on

Base64 Encoding and Decoding Explained, With a Free Online Tool

I'm Sumit Kumar, founder of TooliFyra. Sooner or later every developer meets a string like SGVsbG8sIFdvcmxkIQ== in an API response, a config file or an email header. That is Base64. Here's what it is, when it's useful, and how to encode or decode text quickly, including Hindi text and emoji, which many basic tools get wrong.

What Base64 is

Base64 is a way of representing binary data using only 64 safe, printable ASCII characters: A to Z, a to z, 0 to 9, plus + and /. The = sign at the end is padding. It exists because many text-based systems such as email, JSON and HTML can't safely carry raw binary bytes. Encoding turns the data into plain text that travels intact.

Two things to remember:

  • Base64 makes data about 33% larger.
  • Base64 is not encryption. Anyone can decode it. Never treat it as a way of hiding secrets.

Encode or decode with TooliFyra

  1. Open the Base64 String Encoder/Decoder.
  2. Paste or type your text into the Plain Text Input box.
  3. Click Encode to Base64 to convert plain text, or Decode from Base64 to turn a Base64 string back into readable text.
  4. Click Copy Result to copy the output.

For example, encoding Hello, World! gives SGVsbG8sIFdvcmxkIQ==. Paste that back and click Decode to get the original text.

UTF-8 and Unicode support

A common problem with simple encoders is that they break on anything outside basic English letters. This tool supports full UTF-8, so text in Hindi, Chinese, Arabic and emoji encodes and decodes correctly. If you've ever seen garbled characters after decoding, a missing UTF-8 step is often the reason.

If you paste something that isn't valid Base64, the tool shows a clear error message instead of silent garbage, which helps when you're debugging a truncated or copied-wrongly string.

Where Base64 shows up

  • HTTP Basic Auth: the Authorization: Basic ... header is username:password encoded in Base64. Decoding it shows the pair in plain text, a good reminder to always use HTTPS.
  • Data URIs: small images embedded in HTML or CSS as data:image/png;base64,....
  • JWT tokens: the header and payload are Base64URL-encoded JSON. A JWT uses a URL-safe variation, so for tokens use a dedicated JWT parser rather than a plain Base64 decoder.
  • Email attachments (MIME): files are Base64 encoded for transport.
  • Config and secrets in Kubernetes: values in a Secret manifest are Base64 encoded, not encrypted.

Practical tips

  • Watch for whitespace. A trailing space or newline can make a valid string fail to decode. Trim before pasting.
  • Padding matters. If the length of the string isn't a multiple of four, = characters may have been cut off.
  • Don't confuse Base64 with Base64URL. The URL-safe form swaps + and / for - and _. If decoding fails on a token, that may be why.
  • Don't paste real passwords or private keys into any website you don't trust. This tool runs in your browser and doesn't send data to a server, which is the safer way to do quick checks.
  • For files, use a file-oriented tool. This one is meant for text strings.

Frequently asked questions

Is Base64 secure?
No. It is an encoding, not encryption. Anyone can reverse it.

Why does Base64 end with =?
It's padding that makes the output length a multiple of four characters.

Does it support emoji and non-English text?
Yes, the tool handles full UTF-8 and Unicode.

What happens if I decode an invalid string?
You get a clear error message so you can fix the input.

Is my text uploaded?
No. Encoding and decoding happen in your browser.

Try it yourself with the free Base64 encoder and decoder. You'll find more developer utilities at TooliFyra.

Top comments (0)