How-To Guide

How to Encode Base64 Online: A Complete Guide

Learn how to encode and decode Base64 strings online in seconds. Step-by-step tutorial with real-world use cases for APIs, images, and email attachments.

Published 2026-03-09

Try it right now — free, no sign-up

Use the embedded tool directly in your browser. Your data never leaves your device.

Open Tool →

Base64 encoding is one of the most common tasks in web development — yet many developers still reach for command-line tools or write one-off scripts. This guide shows you how to encode and decode Base64 online in seconds, with no setup required.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a set of 64 printable ASCII characters. It's designed to safely transmit data over channels that only support text — like HTTP headers, JSON payloads, and email attachments.

The name comes from the 64 characters used: A–Z, a–z, 0–9, +, and /, with = used for padding.

Step-by-Step: How to Encode Base64 Online

  1. Open the tool — Go to the Base64 Encoder/Decoder. No login needed.
  2. Paste your text — Type or paste any text into the Input field. This could be a JSON object, a URL, a password, or any string.
  3. Click Encode — Hit the Encode button. Your Base64 output appears instantly in the Output area.
  4. Copy the result — Use the Copy Output button to grab the encoded string to your clipboard.
  5. To decode — Paste any Base64 string into Input and click Decode to get the original text back.

Real-World Use Cases

1. Encoding Credentials for HTTP Basic Auth

HTTP Basic Authentication requires credentials in the format username:password encoded as Base64 in the Authorization header.

# Original
admin:secretpassword123

# Base64 encoded
YWRtaW46c2VjcmV0cGFzc3dvcmQxMjM=

# HTTP header
Authorization: Basic YWRtaW46c2VjcmV0cGFzc3dvcmQxMjM=

2. Embedding Small Images in HTML/CSS

Instead of a separate HTTP request for a small icon, embed it as a Base64 data URI:

<img src="data:image/png;base64,iVBORw0KGgoAAAANS..." />

This is great for critical above-the-fold images and avoids extra network round-trips.

3. Encoding JSON for URL Parameters

When passing JSON data in a URL query string, Base64 encoding prevents special characters from breaking the URL:

# Original JSON
{"user":"alice","role":"admin"}

# Base64 encoded (URL-safe)
eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ==

# Used in URL
https://example.com/dashboard?config=eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ==

Common Mistakes to Avoid

  • Confusing encoding with encryption — Base64 is NOT encryption. Anyone can decode it. Never use it to hide sensitive data.
  • Forgetting padding characters — Base64 strings must have a length divisible by 4. Missing = padding causes decode errors.
  • Using standard Base64 in URLs — The + and / characters are special in URLs. Use URL-safe Base64 (replace + with - and / with _) for URL parameters.
  • Double-encoding — If your Base64 output looks like a Base64 string, you may have encoded an already-encoded value. Always start from raw text.

Related Tools

After encoding your data, you may need these tools:

Ready to try it?

Free online tool — no download, no account, works in your browser.

Open Encode Base64 Tool →

Related Articles