Base64 Encoder & Decoder
Encode text or files to Base64 and decode Base64 back to text — side by side, live. URL-safe Base64 (RFC 4648), MIME line wrapping (76 chars, RFC 2045), file drag-and-drop, data URI auto-strip and encode-each-line mode. 100% client-side.
Base64 Encoder and Decoder Tool
Rate this tool
URL-safe Base64, MIME wrap, file encode, data URI strip — features most Base64 tools skip
Most Base64 tools offer one text box and a button. This tool gives you a live split-view with simultaneous encode and decode, URL-safe Base64 for JWT and web APIs, MIME line wrapping for email and PEM, file drag-and-drop, and automatic data URI prefix stripping for one-click decoding of image embeds.
data:image/png;base64,iVBOR... into the Base64 panel, the decoder automatically strips the prefix before decoding. No manual editing needed.How to encode and decode Base64 online
Base64 variants and when to use them
| Variant | Characters used | Standard | Use case |
|---|---|---|---|
| Standard | A-Z a-z 0-9 + / = | RFC 4648 §4 | General encoding, data storage, HTML data URIs |
| URL-safe | A-Z a-z 0-9 - _ (no padding) | RFC 4648 §5 | URL query params, cookies, filenames, JWT tokens |
| MIME (76-char wrap) | Standard + CRLF every 76 chars | RFC 2045 | Email attachments, MIME content encoding |
| PEM (64-char wrap) | Standard + newline every 64 chars | RFC 7468 | TLS certificates, SSH keys, PGP blocks |
| Each line separately | Standard per line | Custom | Multiple independent values, one per line input |
Base64 Encoder & Decoder — A Complete Guide
Base64 is a binary-to-text encoding scheme that represents binary data as a string of ASCII characters. It converts every three bytes of binary data into four printable characters from a 64-character alphabet: A–Z, a–z, 0–9, + and /. The result is approximately 33% larger than the original data but safe to transmit through any text-based medium — email, JSON, XML, HTTP headers, URLs — without binary data being corrupted or misinterpreted.
Base64 encoder decoder online free text file image
Base64 appears in almost every part of modern web and application development. HTML data URIs use Base64 to embed images directly in CSS and HTML without a separate file request. JWT tokens (JSON Web Tokens) use URL-safe Base64 to encode their header and payload. HTTP Basic Authentication encodes credentials as Base64 in the Authorization header. SMTP email attachments are Base64-encoded by MIME. TLS certificates, SSH keys and PGP blocks use PEM format — Base64 with 64-character line wrapping. API payloads that need to transmit binary data (images, audio, documents) often encode them as Base64 strings inside JSON.
URL safe Base64 encoder online
Standard Base64 uses two characters that have special meaning in URLs: “+” (which URL-encodes as %2B) and “/” (which URL-encodes as %2F). The “=” padding character also causes issues in some URL contexts. URL-safe Base64 (RFC 4648, section 5) solves this by substituting “-” for “+” and “_” for “/”, and typically omitting the “=” padding. The result is a string that can be placed directly in a URL query parameter, cookie value or filename without any percent-encoding. JWT tokens always use URL-safe Base64 for this reason.
Decode Base64 string to text free online
Decoding Base64 reverses the encoding process: it takes four Base64 characters and converts them back to three bytes of binary data. For text data, the bytes are then interpreted as UTF-8. The decoder must handle several common variations: line breaks inserted by MIME (every 76 characters) must be stripped before decoding; URL-safe characters “-” and “_” must be converted to “+” and “/”; missing padding “=” signs must be restored. A robust decoder — like this one — handles all these automatically so you can paste any Base64 variant without pre-processing it.
Base64 image encoder online
Base64-encoded images are embedded in HTML and CSS as data URIs in the format data:[MIME type];base64,[encoded string]. A 1KB PNG icon becomes roughly 1.37KB as a Base64 string. For small images — icons, logos, inline SVGs — the tradeoff is worthwhile: the image loads with the page, requires no separate HTTP request, and is always available even if the CDN is unreachable. For large images the 33% overhead outweighs the benefit. Drop any image file onto the file drop zone in this tool to get the Base64 string; prefix it with the appropriate data URI header to embed it in your CSS or HTML.
Binary to Base64 converter
Any binary file — image, PDF, audio, video, archive — can be Base64-encoded. The encoding treats the file as a stream of raw bytes regardless of format. The FileReader API in modern browsers can read any file as an ArrayBuffer and the btoa function (or TextEncoder/TextDecoder chain) converts the binary data to Base64. This tool uses the FileReader API to read dropped files locally, never uploading them to a server. The output is a raw Base64 string (not a data URI) that you can use in any context that expects Base64-encoded binary data.
Base64 MIME encoding online
MIME (Multipurpose Internet Mail Extensions, RFC 2045) defines how email messages encode attachments and non-ASCII characters. MIME Base64 has one important formatting requirement: lines must be no longer than 76 characters, separated by CRLF (carriage return + line feed). This prevents older email systems from truncating long lines and ensures compatibility with all SMTP implementations. Select “76 chars (MIME)” in the line wrap dropdown to produce MIME-compliant Base64 output suitable for use in email headers, MIME parts and legacy systems that require line-wrapped Base64.