Base64 Encoder & Decoder

Convert any text to Base64 or turn a Base64 string back into readable text. Everything runs locally in your browser, so API keys, tokens and credentials you paste here never leave your machine.

What is Base64?

Base64 is a binary-to-text encoding that represents arbitrary bytes using 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = used for padding. Every 3 bytes of input become 4 characters of output, so a Base64 string is roughly 33% larger than the original data.

It exists because many protocols — email (MIME), HTTP headers, JSON, XML, URLs — were designed for text and can corrupt or reject raw binary bytes. Base64 lets you ship images, certificates, compressed payloads or any other binary safely through text-only channels.

Base64 is not encryption

A common misunderstanding: Base64 does not protect data. Anyone can decode it instantly, including with this tool. If you see a Base64-looking string in a config file or HTTP header (for example an Authorization: Basic … header), treat it as plain text. Use real encryption or hashing when confidentiality matters.

Standard vs. URL-safe Base64

Standard Base64 uses + and /, which have special meaning in URLs and file names. The URL-safe variant (RFC 4648 §5) swaps them for - and _ and usually drops the trailing = padding. JSON Web Tokens, OAuth state parameters and many cloud APIs use the URL-safe alphabet. This tool only understands the standard alphabet, so a URL-safe string must first be converted by hand: replace - with + and _ with / (and add = padding if it was dropped) before decoding.

How to use it

  1. Paste or type your text (or a Base64 string) into the input box.
  2. Choose Encode to produce Base64, or Decode to convert Base64 back to text.
  3. Copy the result with one click. Unicode (emoji, accented characters, CJK text) is encoded as UTF-8 so it round-trips correctly.

Encoding example

The string Hello, World! encodes to:

SGVsbG8sIFdvcmxkIQ==

The two = characters are padding: 13 input bytes is not a multiple of 3, so the final group is padded to a full 4 characters. Decoding the string above returns exactly Hello, World!.

Common use cases

A decode error you will probably hit

This tool decodes the standard alphabet only (A–Z a–z 0–9 + /). Text that uses the URL-safe alphabet fails with an invalid-character error. Compare the standard and URL-safe encodings of the text ???>>>: Pz8/Pj4+ works, while Pz8_Pj4- is rejected. Swap - for + and _ for / by hand and it decodes. Whitespace and line breaks, on the other hand, are removed automatically before decoding.

The tool works on text, not files: it encodes your input as UTF-8 and requires decoded output to be valid UTF-8, so binary data such as an image shows an error rather than garbage. It also has no data-URI or URL-safe output option.

Frequently asked questions

Is my data uploaded when I use this tool?

No. Encoding and decoding happen entirely in your browser using JavaScript. Nothing you paste is sent to our servers.

Why does my decoded output look like garbage characters?

The Base64 string probably represents binary data (an image, a zip file, a protobuf message) rather than text. This tool requires the decoded bytes to be valid UTF-8 text, so binary data usually produces an error instead of readable output. Use a file-based tool for binary payloads.

Why did decoding fail?

Usually the string uses the URL-safe alphabet (- and _) instead of + and /, it is truncated, or it contains stray characters. Whitespace and line breaks are stripped automatically, so they are not the cause. Swap - for + and _ for / by hand and try again.

Does Base64 make data smaller?

No, it makes it about 33% larger. Base64 is for safe transport through text-only systems, not for compression.

Can I decode a JWT segment here?

Only if it contains no - or _ characters. JWT segments use the URL-safe alphabet, so convert those characters to + and / first, or paste the whole token into the JWT Decoder.

Related tools

Explore all developer tools →