Developer · UTF-8

UTF-8 Safe Base64 & Base64URL Encoder / Decoder

Convert plaintext, API credentials, multi-byte Unicode text, or URL-safe JWT segments between raw UTF-8 and Base64 instantly without server exposure.

✓ 100% Browser-Local · Zero Upload Reviewed: 2026-11-26

Initializing local browser workspace...

Encode and Decode Base64 Safely Without Corrupted Unicode

Naive browser scripts relying directly on window.btoa() crash immediately whenever text contains accented European letters, Japanese kanji, Chinese characters, or currency symbols like € and ¥. This tool encodes raw UTF-8 byte streams properly and supports RFC 4648 URL-safe Base64URL.

  • Full UTF-8 multi-byte character support using TextEncoder/TextDecoder
  • One-click toggle between standard RFC 4648 Base64 and URL-safe Base64URL
  • Automatic padding normalization when decoding unpadded Base64URL tokens
  • Instant input/output swap button for round-trip verification
  • Live character length tracking for HTTP header and cookie limits
  • Zero-upload client-side execution safe for Basic Auth headers and secrets

Step-by-Step Guide

  1. Paste plaintext or a Base64 string into the left Input box.
  2. Click Encode -> Base64 or Decode Base64 -> Text depending on your direction.
  3. Enable URL-Safe (- _) when generating strings for URL query parameters, cookies, or JWT segments.
  4. Use Swap to feed the result back into the input pane for instant round-trip testing.

Common Base64 Encoding & Decoding Pitfalls

Confusing Base64 Encoding With Encryption

Base64 is a reversible transport representation—not security. Anyone can decode a Base64 string in milliseconds; use AES-256-GCM encryption if confidentiality is required.

Plus (+) and Slash (/) Breaking URL Query Strings

Standard Base64 emits +, /, and = characters that URL parsers interpret as spaces or separators. Enable URL-Safe Base64URL mode whenever placing encoded tokens inside URLs.

33% Payload Size Overhead

Base64 represents 3 raw bytes using 4 ASCII characters, expanding binary or text payloads by ~33%. Avoid Base64-inlining large images or PDFs into HTML or JSON.

Everyday Developer & API Integration Uses

  • Constructing HTTP Basic Authorization headers (base64(username:password)) for REST API debugging.
  • Inspecting Base64URL-encoded OAuth state parameters, webhook tokens, and SAML assertions.
  • Encoding multi-line SSH keys or JSON certificates for single-line CI/CD environment variables.

Frequently Asked Questions

What is the difference between Base64 and Base64URL?

Base64URL replaces + with - and / with _, and omits trailing = padding so tokens can safely appear inside URLs, filenames, and JWT headers without extra percent-encoding.

Why does this decoder work on unpadded Base64URL strings?

Before decoding, the engine automatically restores standard + and / characters and pads the string length to a multiple of 4, preventing InvalidCharacterError failures.

Can I encode image files into Base64 Data URIs?

Yes—use our dedicated Image to Base64 Data URI tool for drag-and-drop PNG, JPEG, WebP, and SVG file encoding with instant HTML and CSS snippets.

Local Privacy Guarantee: Encoding and decoding occur solely inside your local browser session. Credentials and API keys are never transmitted over the network.