Base64 Decode & Encode Online
An instant Base64 decode and encode tool. Encode text to Base64 or decode Base64 strings instantly. Side-by-side encoding and decoding with copy functionality.
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to encode data that needs to be stored or transferred over media that are designed to deal with textual data.
Key Characteristics:
• Uses 64 characters: A-Z, a-z, 0-9, +, and /
• Padding uses = character when needed
• Increases data size by approximately 33%
• Commonly used in email attachments, data URIs, and API responses
Base64 encoding is essential when you need to embed binary data (like images, files, or encrypted data) into text-based formats such as JSON, XML, or HTML. It ensures that the data can be safely transmitted without corruption.
How to Encode and Decode Base64?
Base64 encoding and decoding can be done using various methods depending on your programming language or tool. Here are the most common approaches:
JavaScript/Node.js
Use the built-in btoa() and atob() functions:
// Encoding
const text = "Hello World";
const encoded = btoa(text);
console.log(encoded); // "SGVsbG8gV29ybGQ="
// Decoding
const decoded = atob(encoded);
console.log(decoded); // "Hello World"Python
Use the base64 module:
import base64
# Encoding
text = "Hello World"
encoded = base64.b64encode(text.encode()).decode()
print(encoded) # "SGVsbG8gV29ybGQ="
# Decoding
decoded = base64.b64decode(encoded).decode()
print(decoded) # "Hello World"Command Line
Use command-line tools:
# Linux/Mac - Encoding
echo -n "Hello World" | base64
# Linux/Mac - Decoding
echo "SGVsbG8gV29ybGQ=" | base64 -d
# Windows PowerShell - Encoding
[Convert]::ToBase64String(
[Text.Encoding]::UTF8.GetBytes("Hello World")
)
# Windows PowerShell - Decoding
[Text.Encoding]::UTF8.GetString(
[Convert]::FromBase64String("SGVsbG8gV29ybGQ=")
)How to Use the Base64 Decode and Encode Tool?
Our Base64 encoder and decoder tool makes it incredibly easy to encode and decode Base64 strings. Follow these simple steps:
Choose Your Operation
Select the Encode tab to convert text to Base64, or the Decode tab to convert Base64 back to text. The tool automatically initializes with example values to help you get started.
Enter Your Text
For encoding, paste or type your text in the input field. For decoding, paste your Base64 string. The conversion happens automatically as you type, with results displayed in real-time on the right side.
Copy the Result
Click the Copy button next to the output field to copy the encoded or decoded result to your clipboard. You can also use the main Encode or Decode button at the bottom to manually trigger the conversion.
Use in Your Project
Paste the copied Base64 string into your code, API request, data URI, or wherever you need it. The tool handles all encoding/decoding automatically, so you don't need to worry about the technical details.
Frequently Asked Questions
What is Base64 encoding used for?
Base64 encoding is commonly used for embedding binary data in text-based formats like JSON, XML, HTML data URIs, email attachments (MIME), and storing binary data in databases. It's also used in authentication mechanisms and API responses.
Does Base64 encoding increase file size?
Yes. Base64 increases size by roughly 33% because it uses four characters to represent every three bytes of binary data. That tradeoff is usually fine when you need safe text transport.
Is Base64 encoding secure?
No. Base64 is not encryption—anyone can decode it. Use it for representation and transport; use real encryption (e.g. AES) when you need confidentiality.
Can I encode images or files with this tool?
This page is for text. For images or binary files, use a dedicated file-to-Base64 flow or our Image Base64 tool, then paste or decode here. Large files are better handled in the CLI or your app.
What characters are used in Base64?
A–Z, a–z, 0–9, plus (+), and slash (/). The equals sign (=) pads the output so the length is a multiple of four.
Why do I see "=" at the end of some Base64 strings?
Padding fills the last group when the input length isn't a multiple of three bytes. One or two = signs may appear at the end; that's normal.
More Tools
Discover more free tools to boost your productivity
Gradient
HEX: #ff5733
RGB: 255, 87, 51
HEX: #4a90e2
RGB: 74, 144, 226
Blog Post
Transform your content...
Social Post
