Menu

Language

Units

Changes the symbol and formatting. It does not convert amounts.

Theme

Suggest a tool

Base64 encoder and decoder

Text to Base64 and back again. With real UTF-8, which is where half the home-made implementations fall over.

Code Encoding and counting No sign-up

Your figures

Processed in your browser. Nothing is sent to a server.
Uses «-» and «_» instead of «+» and «/», and drops the padding. It is what JWTs use.

Result

Result
SGVsbG8sIGphbGFwZcOxbyDwn5GL
Characters in the result
28
Input (bytes)
21
Output (bytes)
28
How much it grows
33.3%

What we assume

  • Everything happens in your browser. Neither the text nor the result leaves your machine.
  • Text is encoded as UTF-8 before going to Base64. Without that step, anything outside ASCII breaks.
  • Base64 is not encryption. It is a way of writing bytes with 64 printable characters: anyone can undo it with no key at all.
  • When decoding, the result must be valid UTF-8 text. If the Base64 held an image or a binary, it cannot be shown here.
  • Input without padding, and with spaces or line breaks, is accepted: it is cleaned before decoding.

How it is calculated

Base64 takes bytes three at a time and rewrites them as four characters from a 64-symbol alphabet. Hence the name, and hence the result always taking a third more room than the input: four characters for every three bytes.

The step almost everyone skips

The browser's btoa does not accept text: it accepts bytes dressed as a string, and fails on anything above U+00FF. A single «ñ» breaks it. Here the text is converted to UTF-8 first, which is why accents and emoji come back whole.

The URL-safe variant

The normal alphabet uses + and /, and both mean something else inside an address. The URL-safe variant swaps them for - and _ and drops the = padding. It is what JWTs use and what you need if the result goes into a parameter.

Not a security measure

Seeing something in Base64 does not mean it is protected. It is encoding, not encryption: there is no key, and undoing it is exactly as easy as doing it.

An example

Hello becomes SGVsbG8=. With accents you can see why the UTF-8 step matters: jalapeño is 9 bytes, not 8, which is why its Base64 is longer than the letters suggest.

Frequently asked questions

Does Base64 hide anything?

No. It is encoding, not encryption: there is no key and anyone undoes it in a second. If you need something unreadable, it has to be properly encrypted.

Why is the result longer than the text?

Because every three bytes become four characters. The growth is a third, roughly 33%, and you can see it in the «how much it grows» figure.

Can I decode an image in Base64?

It can be decoded, but not shown here: this tool works with text. If the content is not valid UTF-8 we say so rather than showing you broken characters.

What is the URL-safe variant?

The same encoding with two characters swapped — - and _ instead of + and / — and no padding, so the result can sit inside an address without breaking it. It is what JWTs use.

Keep calculating

All tools →

Updated on 2026-09-02. Calculations run in your browser; nothing you type is sent to a server.

move · open · Esc close Missing one?