Base64 converts binary data into 64 safe text characters so it can travel through email, JSON, URLs and HTML. It's encoding, not encryption.
Step-by-Step Instructions
- To encode text, paste it into the Base64 Encoder.
- To decode, paste the string into the Base64 Decoder.
- For images, use Image to Base64 to get a data URI.
In Code
// JavaScript (UTF-8 safe)
const b64 = btoa(String.fromCharCode(...new TextEncoder().encode('héllo')));
# Python
import base64; base64.b64encode('héllo'.encode()).decode()When to Use It
- Data URIs for small icons in CSS/HTML.
- HTTP Basic Auth headers.
- Embedding binary data in JSON.
- Email attachments (MIME).
When Not to
Never use Base64 to hide secrets — anyone can decode it. Avoid it for large images: it adds about 33% to size and can't be cached separately.
What Does the "=" at the End Mean?
Base64 turns every 3 bytes into 4 characters. When the input isn't a multiple of 3 bytes, one or two = signs are added as padding so the length is a multiple of 4. Some systems (like JWTs) drop the padding; decoders can usually add it back.
What Is Base64URL?
Standard Base64 uses + and /, which have special meaning in URLs. Base64URL replaces them with - and _ and often omits padding, so the result can sit safely in a URL or filename. JSON Web Tokens use Base64URL.
How Do I Decode Base64 in the Terminal?
On macOS and Linux, run echo 'SGVsbG8=' | base64 --decode. On Windows PowerShell, use [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('SGVsbG8=')).
How Do I Embed an Image With Base64?
Convert the image to a data URL such as data:image/png;base64,iVBORw0… and use it as the src of an <img> tag or in CSS background-image. This saves an HTTP request for tiny icons, but for larger images a normal file is better because it can be cached separately and is about 33% smaller.
Frequently Asked Questions
Get new free tools in your inbox
One short email a month with new tools, guides and productivity tips. No spam — unsubscribe anytime.
By subscribing you agree to receive emails from ToolsPoint Online. See our Privacy Policy.