/ developer & network toolbox
← all tools

$ b64

runs locally

Base64

Encode or decode Base64, UTF-8 safe. Nothing leaves the page.

base64 — invoker.tools

UTF-8 safe, runs entirely in your browser.

About the Base64

This tool encodes plain text into Base64 or decodes a Base64 string back into text, with proper UTF-8 handling so accented characters, emoji and other multibyte content survive the round trip intact.

Base64 exists because a lot of channels only handle a narrow, text-safe set of characters. Turning arbitrary bytes into a 64-character alphabet of letters, digits, plus and slash lets that data travel safely through JSON fields, config files, data URIs, email bodies, HTTP Basic Authorization headers and the header/payload segments of tokens like JWTs.

The tool is client-side. Encoding and decoding both run in your browser using the Web platform's own TextEncoder, TextDecoder and btoa/atob, so nothing you paste is uploaded to a server, and you can safely decode a production secret or a live token while debugging.

It produces standard Base64 (the + / alphabet with = padding), not the base64url variant used inside URLs and JWTs. The section below on Base64 vs Base64url explains exactly when that distinction matters.

How to use it

  1. Choose encode or decode with the mode toggle.
  2. Paste your plain text (to encode) or your Base64 string (to decode) into the input box.
  3. Click the encode or decode button to run the conversion.
  4. Read the result in the output panel below.
  5. Copy the result with one click using the copy button.
  6. Switch modes at any time to reverse the operation and confirm a clean round trip.

Examples

  • Encode hello world to get aGVsbG8gd29ybGQ=.
  • Decode aGVsbG8gd29ybGQ= back into hello world.
  • Encode a UTF-8 string with an accented word or an emoji and decode it back to confirm nothing got corrupted.
  • Encode admin:s3cr3t into YWRtaW46czNjcjN0 to build a Basic Authorization header.
  • Decode the first segment of a JWT (before the first dot) to read its raw header text before it gets JSON-parsed.
  • Paste a Base64 string copied from a log line and decode it to check exactly what value was logged.

How Base64 encoding works

Base64 maps every 3 bytes of input to 4 output characters, each character carrying 6 bits from a fixed 64-symbol alphabet: A-Z, a-z, 0-9, plus and slash. Because 4 characters always come out for every 3 bytes that go in, Base64 output is roughly a third larger than the original data.

When the input length is not a clean multiple of 3 bytes, the output is padded with one or two = characters so its length is always a multiple of 4. That padding is what tells a decoder exactly how many of the final 6-bit groups are meaningful.

  • Input length divisible by 3: no padding needed, output ends in a regular character
  • 1 byte left over: output ends with two padding characters, ==
  • 2 bytes left over: output ends with a single padding character, =

Base64 vs Base64url vs encryption

This tool's output is standard Base64, not the base64url variant, and Base64 in general is not encryption. Both distinctions matter and are easy to mix up.

  • Standard Base64: alphabet A-Z a-z 0-9 + /, padded with =. Used in email (MIME), data URIs, and this tool's output.
  • Base64url: alphabet A-Z a-z 0-9 - _, usually without padding. Used in JWT header/payload segments, URL query parameters and filenames, because + / = are awkward inside a URL.
  • Base64 is not encryption: reversing it takes no secret key, so it provides zero confidentiality. Treat anything Base64-encoded as fully readable by anyone who has it.

Common decode errors and how to avoid them

Most "invalid Base64 input" errors come from the string itself being subtly wrong rather than a bug in the decoder. Surrounding whitespace is trimmed automatically before decoding, so a stray newline from copy-paste is not usually the problem; the character content is.

  • Truncated copy-paste: the trailing = padding, or a character from the middle, got cut off when the string was copied
  • Base64url mixed in: a dash (-) or underscore (_) from a base64url string is not part of the standard alphabet and fails here
  • Extra characters: quotes, brackets or commas copied along with the string from a JSON field or log line

Frequently asked questions

What is Base64 encoding?

Base64 represents binary or text data using a 64-character ASCII alphabet, making it safe to carry in places that expect plain text, such as JSON, URLs and email.

Is Base64 the same as encryption?

No. Base64 is reversible encoding, not encryption. Anyone can decode it without a key, so it provides no confidentiality or security on its own.

Does this tool handle UTF-8 and emoji?

Yes. It uses TextEncoder and TextDecoder under the hood, so accented characters, emoji and other multibyte text encode and decode correctly.

Is my text uploaded to a server?

No. All encoding and decoding happens locally in your browser, so your input never leaves your device.

What is the difference between Base64 and Base64url?

Base64url swaps + for - and / for _, and usually drops the = padding, so the result is safe to use directly inside a URL or filename. This tool produces standard Base64, not base64url.

Why does Base64 output end with an equals sign?

The = characters are padding, added when the input length isn't an exact multiple of 3 bytes, so the output length stays a multiple of 4.

Can I decode a JWT's header or payload with this tool?

You can decode the individual segments if you first split the token on its dots, since JWT segments use base64url rather than standard Base64. For full JWT decoding including the exp/iat/nbf claims, use the dedicated JWT decoder instead.

Why am I getting an "invalid Base64 input" error?

The string usually contains a character outside the standard Base64 alphabet, such as a base64url dash or underscore, or is missing correct padding, often from a truncated copy-paste.

Does Base64 increase the size of my data?

Yes, by roughly a third. Every 3 bytes of input become 4 output characters, so a 300-byte input produces about 400 characters of Base64.

Can I use this to encode binary files like images?

This tool takes text input via UTF-8 encoding, so it is built for encoding and decoding text strings such as tokens, headers and config values, not for uploading and encoding arbitrary binary files.

More encode / decode tools