🔢 Encoder Tools

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.

Live encode + decode side by side URL-safe Base64 (RFC 4648) MIME 76-char line wrap File encode & decode
AdSense — 728×90 Leaderboard

Base64 Encoder and Decoder Tool

Options: Line wrap:
Plain text / binary
Base64 output
📤
Drop any file to encode it to Base64
File is read locally — never uploaded. Useful for encoding images, PDFs and binary files.
AdSense — 728×90 Leaderboard
🔒
Need to verify a hash or generate an HMAC?
The free Hash Generator computes MD5, SHA-256, SHA-512 and SHA-3 simultaneously from text or files. HMAC mode, file drag-and-drop, hash comparison tab and URL-safe hash verification — a natural companion to Base64 encoding workflows.
🔒 Hash Generator →
⭐ User Ratings

Rate this tool

4.9
Based on 38,241 ratings
5
34,799
4
2,294
3
765
2
191
1
192
Was this Base64 tool helpful?
Thank you for your rating!
Features

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.

Live split view
Plain text on the left, Base64 on the right. Both update as you type. Click Encode to push left to right; click Decode to push right to left. The swap button exchanges panels so you can verify a round-trip instantly. No page reload, no button required for live encoding.
🔗
URL-safe Base64 (RFC 4648)
Standard Base64 uses “+” and “/” which must be percent-encoded in URLs. URL-safe mode replaces them with “-” and “_” and optionally removes padding “=” signs — producing strings safe for query parameters, cookies, filenames and JWT tokens. Absent on most free Base64 tools.
📧
MIME and PEM line wrapping
MIME (RFC 2045) requires Base64 to be wrapped at 76 characters per line for email compatibility. PEM certificates use 64 characters per line. Select the line wrap width in the options bar. The decoder automatically handles wrapped input, stripping line breaks before decoding.
📂
File drag-and-drop encode
Drop any file — image, PDF, audio, archive — onto the drop zone and the tool reads it as binary and encodes it to Base64. Useful for embedding files in HTML data URIs, API payloads and JSON. File processing uses the FileReader API locally — no upload to any server.
✂️
Data URI auto-strip on decode
If you paste a full data URI like data:image/png;base64,iVBOR... into the Base64 panel, the decoder automatically strips the prefix before decoding. No manual editing needed.
Decode validation
The Base64 panel shows a green “Valid Base64” indicator when the content is valid, or a red “Invalid Base64” warning when it contains illegal characters. The decoder is forgiving: it strips whitespace and line breaks automatically before validating.
How to use

How to encode and decode Base64 online

1
Choose your options
Select URL-safe if you need Base64 for URLs, cookies, filenames or JWT tokens. Select No padding to remove trailing “=” signs. Select a line wrap width for MIME email encoding (76 chars) or PEM certificates (64 chars). Options apply immediately to both encode and decode.
2
Encode: type text or drop a file
Type or paste plain text in the left panel — the Base64 output updates live on the right. For binary files (images, PDFs, archives), drag and drop them onto the file drop zone below the editor. The file is read locally and its Base64 appears in the output panel.
3
Copy the Base64 output
Click Copy in the Base64 panel header to copy the encoded string to your clipboard. The output respects all current options — URL-safe, no-padding and line wrapping. Paste directly into your HTML, CSS, JavaScript, JSON, email client or API request.
4
Decode: paste Base64 on the right
Paste any Base64 string — including full data URIs like data:image/png;base64,... — into the right panel and click Decode. The plain text appears on the left. The decoder strips data URI prefixes, line breaks and whitespace automatically. The status bar shows whether the input is valid Base64.
5
Verify with the round-trip swap
Click the ⇄ swap button to exchange the left and right panels. Encode → swap → decode to verify that a round-trip returns exactly the original text. Useful for checking that line wrapping, padding settings and URL-safe mode produce correct results for your use case.
Quick reference

Base64 variants and when to use them

VariantCharacters usedStandardUse case
StandardA-Z a-z 0-9 + / =RFC 4648 §4General encoding, data storage, HTML data URIs
URL-safeA-Z a-z 0-9 - _ (no padding)RFC 4648 §5URL query params, cookies, filenames, JWT tokens
MIME (76-char wrap)Standard + CRLF every 76 charsRFC 2045Email attachments, MIME content encoding
PEM (64-char wrap)Standard + newline every 64 charsRFC 7468TLS certificates, SSH keys, PGP blocks
Each line separatelyStandard per lineCustomMultiple independent values, one per line input
Complete guide

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.

Frequently asked questions

Base64 is a binary-to-text encoding that converts binary data into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is used to safely transmit binary data through text-only channels like email, JSON, XML and URLs. Base64 is not encryption — it does not hide data, it only changes how data is represented.
Paste the Base64 string into the right panel above and click Decode. The decoded plain text appears in the left panel. If you paste a full data URI (data:image/png;base64,...), the prefix is stripped automatically. The decoder also handles URL-safe Base64 (with - and _) and MIME-wrapped Base64 (with line breaks).
URL-safe Base64 (RFC 4648, section 5) replaces the “+” character with “-” and “/” with “_”, and typically removes the “=” padding. Standard Base64 characters “+” and “/” have special meaning in URLs (+ means space in query strings, / separates path segments). URL-safe Base64 avoids these issues and is used in JWT tokens, cookie values and filenames.
Base64 encodes every 3 bytes of input as 4 output characters, which is a ratio of 4/3 ‸ 1.333. This means Base64-encoded data is approximately 33% larger than the original. With MIME line wrapping, the CRLF characters add a further small overhead. The size ratio is shown in the left panel footer when encoding.
MIME (RFC 2045) requires Base64-encoded data to be wrapped at 76 characters per line to ensure compatibility with older email systems that cannot handle very long lines. Select “76 chars (MIME)” in the line wrap dropdown to produce MIME-compliant output. PEM certificates use 64-character wrapping. The decoder ignores line breaks automatically.
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string without a key — it provides no confidentiality or security. Base64 is used purely to make binary data safe for text-based channels. If you need to protect data, use proper encryption (AES, RSA) in addition to Base64 encoding.
Drag and drop your image file onto the file drop zone below the editor. The tool reads the file locally using the FileReader API and encodes it to Base64. To use it as a data URI in HTML, prefix the output with data:[image/mime-type];base64, — for example, data:image/png;base64, followed by the encoded string. To get the complete data URI directly, use the Image to Base64 tool.
Yes. All encoding and decoding happens entirely in your browser using JavaScript's btoa and atob functions (and TextEncoder/TextDecoder for Unicode support). Files are read using the FileReader API without uploading. No text, file or result is ever sent to any server or stored anywhere.
Related tools

More free encoding tools