Encoders, Hash & Security Tools

Free Base64 Encoder and Decoder

A browser-based Base64 encoder and decoder. Convert any text to Base64 encoding for use in data URIs, API authentication headers, email attachments, or config files. Decode Base64 strings back to readable text. Supports both standard Base64 and URL-safe Base64 (using - and _ instead of + and /).

Loading tool...

What is Base64 Encoder and Decoder?

A browser-based Base64 encoder and decoder. Convert any text to Base64 encoding for use in data URIs, API authentication headers, email attachments, or config files. Decode Base64 strings back to readable text. Supports both standard Base64 and URL-safe Base64 (using - and _ instead of + and /).

quickAnswer

Encode text to Base64 or decode Base64 back to text. Supports standard and URL-safe Base64. All processing happens locally in your browser.

Last updated: 2026-06-05

limitations

  • Designed for text encoding/decoding — encoding large binary files (over a few MB) may be slow and is better handled by dedicated tools.
  • Does not support chunked or streaming Base64 encoding — the entire input is processed at once.
  • UTF-8 text is assumed for both encoding input and decoding output — other character encodings may produce unexpected results.

Sources:MDN Web Docs · W3C Specifications · jquery.app on GitHub

How to use this tool

  1. Choose Encode (text to Base64) or Decode (Base64 to text).
  2. Paste your input into the text area.
  3. Toggle URL-safe mode if working with URLs or filenames.
  4. Copy the result.

What you can use it for

  • Encode credentials for a Basic Authentication header (username:password to Base64).
  • Decode a Base64-encoded JWT payload or API response to see the original content.
  • Create a Base64 data URI for embedding small images or SVGs directly in CSS or HTML.

Use cases

Practical examples

example

Create a Basic Auth header

A developer needs to add Basic Authentication to an API request. They encode 'username:password' to Base64 and add it as the Authorization: Basic <base64> header in their HTTP request.

example

Decode a Base64 API response

An API returns a Base64-encoded value. The developer pastes the Base64 string into the decoder and immediately sees the decoded JSON or text content for debugging.

Common mistakes

  • Confusing Base64 encoding with encryption — Base64 is reversible by anyone and provides no security.
  • Forgetting that Base64 increases data size by approximately 33% — a 1KB file becomes about 1.37KB when Base64-encoded.
  • Using standard Base64 in URLs without converting to URL-safe variant — + and / characters in standard Base64 break URL parsing.

verification

  1. Encode a simple string like 'Hello' and verify the output is 'SGVsbG8='. Decode it back to confirm the round-trip.
  2. Test URL-safe mode by encoding a string and verifying the output contains - and _ instead of + and /.

FAQ

Questions about Base64 Encoder and Decoder

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

Standard Base64 uses + and / as the 62nd and 63rd characters, with = for padding. URL-safe Base64 replaces + with - and / with _, and typically omits padding (=). URL-safe encoding is safe to use in URLs, filenames, and JWT tokens without additional percent-encoding.

Can I encode binary files like images?

This tool is designed for text encoding. For binary files, you would need to read the file as a byte array first. The browser's FileReader API can read files as data URLs which include Base64 encoding. For small text-based needs, this tool works well.

Why does my decoded Base64 show garbled characters?

Base64 can encode any binary data. If the original data was not UTF-8 text (e.g., it was an image, PDF, or encoded in another charset), decoding it as UTF-8 will show garbled output. Make sure the source data was text before expecting readable output.

Related tools

More encoders, hash & security tools

Encoders, Hash & Security Tools

COOP/COEP/CORP Header Builder

Build Cross-Origin isolation headers for SharedArrayBuffer, WebAssembly threads, and cross-origin security. Choose from presets with debugging checklists.

Open tool

Encoders, Hash & Security Tools

CORS Header Generator

Generate CORS HTTP headers for any origin, method, and credential configuration. Output in raw HTTP, Nginx, Apache, Express, or Cloudflare Workers format.

Open tool

Encoders, Hash & Security Tools

CSP Hash Generator

Generate CSP hash values for inline scripts and styles. Hash exact code content with SHA-256, SHA-384, or SHA-512 and get the matching CSP directive snippet.

Open tool

Also try

Also try