Base64 Encoder / Decoder

Encode or decode Base64 strings instantly

About this tool

The ToolNinja Base64 tool is a free online Base64 encoder and decoder. Encode any text or data to Base64 format, or decode Base64 strings back to plain text โ€” instantly, with no page reload. Use the Base64 encoder when you need to embed binary data in JSON APIs, create data URIs for images in CSS or HTML, encode credentials for HTTP Basic Authentication headers, or prepare data for email transmission. Use the Base64 decoder to inspect encoded strings in API responses, JWT token segments, or any Base64 encoded content you encounter during development. Supports both standard Base64 and Base64URL encoding (used in JWT tokens and URLs). The tool automatically handles padding and correctly encodes all Unicode characters. Runs entirely in your browser โ€” your data never leaves your machine. No login, no server, no tracking.

When to use it

  • โ†’Encoding credentials for HTTP Basic Authentication headers
  • โ†’Embedding small images as data URIs directly in HTML or CSS
  • โ†’Storing binary data safely inside JSON or XML payloads
  • โ†’Decoding Base64-encoded strings from API responses or JWT tokens

Tips

  • โ—†Standard Base64 uses + and / โ€” URL-safe Base64 replaces them with - and _ for use in query strings and JWT tokens.
  • โ—†Every 3 bytes of input produce exactly 4 Base64 characters. = padding characters make the output length a multiple of 4.
  • โ—†Base64 increases data size by ~33%. Don't use it for large files.

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 is encoding, not encryption. It is trivially reversible by anyone โ€” there is no key, no secret, and no security involved. Never use it to protect sensitive data.

What's the difference between Base64 and Base64 URL-safe?

Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ so the encoded string can be used in URLs and HTTP headers without additional percent-encoding.

Why does my decoded Base64 show garbled characters?

This usually means the original data was binary (an image, file, or compressed payload) rather than plain text. Binary data can't be displayed as readable text โ€” you'd need to save it as a file to use it.

How do I Base64-encode a file, not just text?

Use the Image to Base64 tool for images. For arbitrary files, you can use the command line: on macOS/Linux run `base64 filename`, on Windows run `certutil -encode filename output.txt`.

Related tools

๐Ÿฅท ToolNinja