Base64 Encode / Decode

Encode text to Base64 or decode Base64 back to text. URL-safe mode, line wrap, padding options. Everything runs locally.

Enter text and click Encode.
Advanced — Standard · No wrap · Padding on
Input Size
Output Size
Ratio
Encoding

What is Base64 Encode / Decode?

Base64 encoding converts binary or text data into a 64-character ASCII string (A–Z, a–z, 0–9, +, /). Many systems—URLs, emails, JSON, XML—only accept safe ASCII. Base64 lets you embed binary data or special characters without corruption. Common uses include embedding images as data URIs (data:image/png;base64,...), encoding auth tokens in headers, and passing binary payloads in APIs.

This tool encodes and decodes Base64 entirely in your browser. No uploads, no server round-trips. It supports standard Base64 and URL-safe mode, which replaces + with - and / with _ so the result is safe in URLs and query strings. You can toggle line wrapping (76 chars, MIME-style) and padding.

Base64 is encoding, not encryption. Anyone can decode it. Use it for transport and compatibility, not for hiding secrets.

How to Use Base64 Encode / Decode

  1. Switch between the Encode and Decode tabs at the top.
  2. To encode: Paste or type text in the input area and click Encode. The Base64 result appears below. Open Advanced for URL-safe mode (for URLs/query strings), line wrap at 76 chars (MIME), and padding on/off.
  3. To decode: Switch to the Decode tab, paste a Base64 string, and click Decode. The tool normalizes URL-safe variants and handles common formatting (spaces, line breaks). Invalid Base64 shows an error.
  4. Use Copy to copy the encoded or decoded result. Use Sample (encode mode) loads example text. Stats show input size, output size, ratio, and encoding type.

Example: Encode Hello, World! to get SGVsbG8sIFdvcmxkIQ==. For URL-safe output, enable URL-safe mode in Advanced to get SGVsbG8sIFdvcmxkIQ (padding stripped). To decode a JWT payload, paste the middle part (between the dots) into the Decode tab—but for full JWT parsing, use our JWT Decoder.

Tips & Best Practices

Use Ctrl+Enter to run (encode or decode depending on the active tab). Ctrl+Shift+C copies the output. Esc clears the current pane. Enable URL-safe mode when embedding Base64 in URLs or query parameters. Enable Line wrap when the result will go in email or MIME parts. Disable padding only if the receiving system expects unpadded Base64 (e.g. some JWT implementations).

If decoding fails, remove spaces and line breaks. For URL-safe input, the tool auto-converts - to + and _ to /. Invalid characters or wrong length will trigger an error.

When to Use This Tool

Use this tool when you need to encode text for URLs, decode API responses, inspect data URIs, or debug auth headers. It's ideal for quick encode/decode without writing code. For HTML entities, use our HTML Encode/Decode. For JWT tokens, use the JWT Decoder. For JSON formatting, use the JSON Formatter. This tool focuses on Base64 only—no other encodings or transformations.

Frequently Asked Questions

What is Base64 encoding?

Base64 converts binary or text data into a 64-character ASCII string. It's used for embedding data in URLs, emails, and APIs where raw binary isn't allowed.

What is URL-safe Base64?

URL-safe Base64 replaces + with - and / with _ and strips padding. Use it when embedding Base64 in URLs or query strings to avoid encoding issues.

Is Base64 encoding secure?

Base64 is not encryption—it's encoding. Anyone can decode it. Use it for data transport, not for hiding secrets. For encoding HTML, try our HTML encode/decode tool.

Does this tool send my data to a server?

No. All encoding and decoding runs in your browser. Your text never leaves your device.

Why does Base64 decoding fail sometimes?

Invalid Base64 has wrong characters or length. Remove spaces, line breaks, or URL-safe variants (replace - with + and _ with /). The tool handles common formats.

Can I encode binary files?

This tool works with text. For file encoding, paste the file content as text. For JWT tokens, use our JWT decoder. For JSON, use the JSON formatter.