Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to text. UTF-8 aware, supports characters beyond ASCII.

How to use

  1. Paste the text or the Base64 string into the box.
  2. Click Encode to convert text to Base64, or Decode to convert Base64 back to text.
  3. Tick URL-safe if the value goes in a URL or a JWT — it uses - and _ and omits padding.
  4. Click Copy to put the result on your clipboard.

What does it do?

Base64 encodes arbitrary bytes as 64 printable ASCII characters, so binary-unsafe transports (JSON strings, URLs, email bodies, environment variables, HTTP Basic auth) can carry them without mangling. This tool handles UTF-8 input correctly — it encodes your string to UTF-8 bytes first, then Base64-encodes those bytes, so non-ASCII characters round-trip cleanly. Output is about 33% larger than input (every 3 bytes become 4 characters).

Example

Encoding the text Hello, world!:

SGVsbG8sIHdvcmxkIQ==

Encoding the same text with URL-safe on (padding stripped):

SGVsbG8sIHdvcmxkIQ

Encoding the emoji text café ☕:

Y2Fmw6kg4piV

Why is my Base64 string not decoding?

  • Standard vs URL-safe mismatch. Strings with - or _ are base64url, not standard Base64. Toggle the URL-safe checkbox to match.
  • Missing padding. A standard Base64 string length must be a multiple of 4. SGVsbG8 fails; SGVsbG8= works. Pad with = until the length divides by 4.
  • Whitespace and newlines inside the value. Some systems wrap Base64 at 76 characters with \n. Most decoders tolerate this, but stricter ones do not. Strip whitespace before decoding.
  • Accidentally decoded twice. Decoding U0dWc2JHOA== gives SGVsbG8, which is itself a Base64 string. If your output looks like more Base64, decode it again.
  • Non-UTF-8 binary data. If the decoded bytes aren't valid UTF-8 (e.g. a PNG header), decoding as text will fail or show garbage. Use a file-aware Base64 tool for binary.
  • Smart quotes or visible ellipsis. Copying from a word processor can substitute " with curly quotes or trim long strings with an ellipsis. Paste through a plain-text editor first.

Is my data private?

Yes. We don't save any text you paste here — nothing is stored, logged, or retained. Whatever you encode or decode is gone as soon as you close or refresh the tab. There's no record on our side of what you ran through the tool. You're welcome to verify in your browser's developer tools if you want extra confidence.

Frequently asked questions

What is the difference between standard Base64 and URL-safe Base64?

Standard Base64 (RFC 4648) uses + and / and pads with =. URL-safe Base64 (base64url) replaces + with - and / with _ and usually omits padding so the string survives as a URL path or query parameter unchanged. JWTs use base64url. Pick the URL-safe checkbox when the output goes into a URL.

Does this tool handle emoji and non-ASCII text correctly?

Yes. Input is first encoded as UTF-8 bytes, then those bytes are Base64-encoded. Decoding reverses both steps. This is why pasting "café" and decoding the result gives you "café" back, not mojibake. Many older Base64 tools assume Latin-1 and corrupt anything outside ASCII.

Can I encode a binary file like an image or PDF?

This page encodes text only. To Base64-encode a file, drop the file into a tool that reads it as binary (or use the browser console with FileReader.readAsDataURL). This tool is for encoding strings — the typical use case when embedding credentials, config, or JSON fields.

Why does my decoded output look like garbage?

Usually the input was not Base64 to begin with, or it was URL-safe Base64 decoded as standard (or vice versa). Try toggling the URL-safe checkbox. Another common cause is decoding a string that is actually Base64-encoded binary, not text — in that case the bytes are not valid UTF-8.

Does the = padding matter?

Standard Base64 pads the output so its length is a multiple of 4. Most decoders accept input without padding, but some strict ones reject it. URL-safe Base64 typically omits padding. If a decoder complains, add = signs until the length is divisible by 4, or strip them all and retry.

Do you save any of the text I encode or decode?

No. We don't save any text you paste here. Your input is discarded the moment you close or refresh the page — nothing is kept, and there's no record of what you encoded or decoded. If you want an extra layer of confidence, you can check your browser's developer tools.

Related tools