How to Encode Text to Base64
- Select the Encode → Base64 tab.
- Choose Text if encoding a string, or File / Image if encoding a file.
- Type or paste your text in the left box — the Base64 output appears instantly on the right.
- For files, drop or click to upload. The Base64 data URL appears below, with an image preview for image files.
- Click Copy to copy the output to your clipboard.
How to Decode Base64
- Select the Decode ← Base64 tab.
- Paste your Base64 string into the left box. Whitespace is stripped automatically.
- The decoded text appears on the right. For data URLs (
data:image/png;base64,…), the image is rendered inline. - Use Download file to save a decoded binary file (image, PDF, etc.).
What is Base64?
Base64 is an encoding scheme defined in RFC 4648 that represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /, with = used as padding. The name comes from the alphabet size: 2⁶ = 64.
Every 3 bytes of input become 4 Base64 characters. This means encoded output is roughly 33% larger than the original. Base64 is not compression — it trades size for text-safe representation.
Common Uses of Base64
| Use case | Example |
|---|---|
| HTTP Basic Auth | Authorization: Basic dXNlcjpwYXNz |
| Embed images in HTML/CSS | src="data:image/png;base64,iVBOR…" |
| JSON API payloads | { "file": "JVBERi0xLjQ…" } |
| Email attachments (MIME) | Content-Transfer-Encoding: base64 |
| JWT token parts | eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1MSJ9… |
| CSS font embedding | @font-face { src: url('data:font/woff2;base64,…') } |
| SVG inline in HTML | background-image: url('data:image/svg+xml;base64,…') |
Base64 vs Base64URL
Standard Base64 uses + and / — characters that have special meaning in URLs. Base64URL (defined in RFC 4648 §5) replaces them with - and _and omits the = padding, making it safe to embed in URLs and cookie values without percent-encoding. JWTs use Base64URL for their header and payload sections.
Base64 for HTTP Basic Authentication
HTTP Basic Auth sends credentials as username:password encoded in Base64. To construct the header manually:
- Paste
username:password(with the colon) into the Encode text box. - Copy the Base64 output.
- Use it as:
Authorization: Basic <output>
Remember: Basic Auth is only secure over HTTPS. Anyone who intercepts the header can trivially decode it — Base64 is not encryption.
Frequently Asked Questions
What is Base64 encoding?
Base64 converts binary data into 64 printable ASCII characters so it can be safely embedded in text-based formats like JSON, XML, HTML, HTTP headers, and email. It is not encryption — anyone can decode it without a key.
Does Base64 encrypt my data?
No. Base64 is encoding, not encryption. The encoded string can be decoded by anyone with a Base64 decoder. If you need to protect data, use a real encryption algorithm like AES-256.
Is my data uploaded to a server?
No. Everything happens in your browser using JavaScript's built-in btoa(), atob(), TextEncoder, TextDecoder, and FileReader APIs. Your files and text never leave your device.
How do I embed an image in HTML using Base64?
Upload your image in the File / Image tab, copy the data URL output, and use it as an <img> src: <img src="data:image/png;base64,iVBOR…">. The browser renders the image directly from the string — no separate file request needed.
Why does the encoded output end with = or ==?
Base64 encodes every 3 bytes into 4 characters. If the input length is not a multiple of 3, one or two = padding characters are appended to make the output length a multiple of 4. This is required by the specification.