Skip to content

Base64 encoder and decoder

Convert text and files to Base64 and back.

DeveloperRuns in your browser

38 characters · 38 B

Encode
SGVsbG8sIHRoaXMgY2FuIGJlIGNvbnZlcnRlZCB0byBCYXNlNjQ=

52 characters · 52 B

This tool encodes and decodes Base64 instantly, with full UTF-8 support (accented letters, emoji) and the Base64URL variant used by URLs and JWTs. You can also drop a file to convert it straight to Base64 — handy for embedding a small image in CSS or HTML.

Everything happens in your browser: neither the text nor the files you convert are ever uploaded to a server.

How to use

  1. 1Type or paste text to encode it, or paste Base64 to decode it.
  2. 2Leave the mode on “Auto” to detect it automatically, or force “Encode”/“Decode”.
  3. 3Pick the variant: standard Base64, or Base64URL if the target is a URL or a JWT.
  4. 4Switch to “File” if you need to convert an image or another file to Base64.
  5. 5Copy the result or download it as a text file.

What you can do

  • UTF-8 encoding and decoding
  • Base64URL variant
  • Files to Base64

What Base64 is used for

Base64 turns binary data (or text) into a string made only of letters, digits and a couple of symbols, so it can travel safely through channels designed for text: JSON request bodies, HTTP headers, emails, or data URLs embedded in HTML.

  • Embedding a small image directly in CSS or HTML (a data URL).
  • Sending binary data inside a JSON payload or a form field.
  • Reading HTTP Basic auth credentials (Authorization: Basic …).
  • Encoding a JWT's header and payload.

What is the difference between Base64 and Base64URL?

Standard Base64 uses “+” and “/”, and pads the end with “=” signs up to a multiple of 4 characters. Those symbols are awkward inside a URL, since “+” and “/” already have special meaning there.

Base64URL fixes that by swapping “+” for “-” and “/” for “_”, and usually skips the “=” padding entirely. It's the variant used by JWTs and many share links, since it can sit inside a URL without any extra escaping.

Common decoding errors

Most decode failures come from an incomplete string: it's easy to lose the last character or the “=” padding when copying and pasting. Decoding also fails if the text has stray spaces or line breaks in the middle, or characters outside the chosen variant's alphabet (for example, a “+” inside a Base64URL string).

  • Make sure you copied the whole string, without cutting it short.
  • If the text came from a URL or a JWT, try the Base64URL variant.
  • Strip any spaces or line breaks that slipped in while copying.

Frequently asked questions

What is Base64 and what is it used for?

It's a way to represent binary data as text, using only letters, digits, “+”, “/” and “=” padding. It's used to move data through channels built for text: JSON, email, URLs and HTTP headers.

What is the difference between Base64 and Base64URL?

Standard Base64 uses “+” and “/”, symbols that have special meaning inside a URL. Base64URL replaces them with “-” and “_” and usually drops the “=” padding, so it can be dropped into a URL or a JWT without any extra escaping.

Why does decoding my Base64 text fail?

Almost always because the string is incomplete (missing “=” padding, or a character was lost while copying) or because the variants got mixed up: text with “-” or “_” is Base64URL, not standard Base64, and vice versa.

Is Base64 a form of encryption or security?

No. Base64 only changes how data is represented — it doesn't hide it. Anyone can decode it with no key at all. Never use it to protect sensitive information; that requires real encryption.

Can I convert a file to Base64 with this tool?

Yes. Switch the source to “File”, drop the file or pick it, and you'll get its Base64-encoded content, ready to copy or download as text.

Are my files or text uploaded to a server?

No. Both text and files are processed entirely in your browser; nothing is sent to a server during conversion.

More in Developer