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-09Try it right now — free, no sign-up
Use the embedded tool directly in your browser. Your data never leaves your device.
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
- Open the tool — Go to the Base64 Encoder/Decoder. No login needed.
- 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.
- Click Encode — Hit the Encode button. Your Base64 output appears instantly in the Output area.
- Copy the result — Use the Copy Output button to grab the encoded string to your clipboard.
- 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:
- URL Encoder/Decoder — Encode special characters for safe use in URLs
- JWT Decoder — JWTs contain Base64-encoded payloads you can inspect
- Hash Generator — For actual one-way encryption (SHA-256, MD5)
Ready to try it?
Free online tool — no download, no account, works in your browser.
Open Encode Base64 Tool →Related Articles
How to Format JSON Online: Step-by-Step Tutorial
Format, validate, and minify JSON online for free. Step-by-step guide with real-world examples for APIs, configs, and debugging.
How-To GuideHow to Decode JWT Online in 3 Steps
Decode and inspect JSON Web Tokens online in seconds. Learn what's inside a JWT — header, payload, and signature — with real examples.
How-To GuideHow to Minify CSS Online: Save File Size Fast
Minify your CSS online for free to reduce file size and speed up page load times. Step-by-step guide with before/after size comparisons.
How-To GuideHow to Generate UUID Online: Quick Reference Guide
Generate UUIDs (v4) online instantly. Learn what UUIDs are, when to use them, and how to generate bulk UUIDs for databases, APIs, and testing.