Base64 Encoder/Decoder
Encode and decode Base64 strings, files, images with data URL support. Upload files or paste text for instant conversion.
Base64 Encoder/Decoder
Encode and decode Base64 text, files, and data URLs
Convert text/files to Base64 format
Tips & Info
Free Base64 Encoder and Decoder Online
Base64 is an encoding scheme that converts binary data into a text-safe ASCII string. It is not encryption: it is a way to represent binary content (images, files, arbitrary bytes) in a format that can travel safely through text-based protocols like HTTP, JSON, email, and HTML attributes. Base64 increases data size by about 33%.
This free Base64 encoder/decoder handles text, file uploads, and images, including generating data URLs for embedding images directly in HTML or CSS without separate HTTP requests.
How to encode or decode Base64
- Choose Encode or Decode mode.
- Paste text or upload a file or image.
- The result appears instantly with size and overhead statistics.
- For decoded images, preview the result directly in the tool.
- Copy the output or download the decoded file.
Common developer use cases
- CSS data URLs: Embed small icons and images directly in CSS with
background-image: url("data:image/png;base64,...")to eliminate extra HTTP requests. - API file uploads: Encode a binary file (PDF, image) to a Base64 string for transmission in a JSON request body.
- HTTP Basic Auth: The
Authorization: Basicheader encodesusername:passwordas Base64. - JWT tokens: JWT header and payload are Base64URL encoded (Base64 with
+replaced by-and/by_). - Email attachments: MIME uses Base64 to encode binary attachments in plain-text email messages.
- HTML inline images: Use
<img src="data:image/png;base64,...">to embed images without separate file hosting.
Base64 vs Base64URL
Standard Base64 uses + and / as the last two characters, which are URL-unsafe. Base64URL replaces them with - and _ respectively, making the output safe for use in URLs and HTTP headers without percent-encoding. JWTs always use Base64URL encoding.
Frequently Asked Questions
Is Base64 encryption?
No. Base64 is an encoding: anyone can decode it instantly and there is no key. It only makes binary data safe to carry inside text such as JSON, HTML attributes, URLs or email. To protect data you need encryption on top, for example AES, and then Base64 to transport the ciphertext.
Why is my Base64 string larger than the original file?
Base64 turns every 3 bytes into 4 ASCII characters, so the output is about 33 percent bigger, plus a little padding. The size statistics show the exact overhead. For large files it is usually better to upload the binary directly and keep Base64 for small assets such as icons.
What is the difference between Base64 and Base64URL?
Standard Base64 uses + and / and pads with =. Base64URL replaces them with - and _ and drops the padding, so the value can sit in a URL or an HTTP header without percent encoding. JWT tokens use Base64URL. This tool encodes either way and decodes both, padding or not.
How do I turn an image into a data URL?
Upload the image, tick Generate Data URL, and the MIME type is filled from the file. The output starts with data:image/png;base64, and can be pasted into an img src attribute or a CSS url(). Keep it for images under a few kilobytes: larger ones are better served as files so the browser can cache them.
Why does decoding show a hex preview instead of text?
The decoded bytes are not valid UTF-8 text, so it is a binary file. The tool detects PNG, JPEG, GIF, WebP, SVG, PDF, ZIP and GZIP from the first bytes, previews images inline and lets you download the file with the right extension.
Related
Free forever, no ads, no tracking. Support the project