Base64 Encoder & Decoder
Turn text or any file into Base64, or decode Base64 back to readable text or the original file. Full UTF-8 and emoji support, URL-safe output, and nothing ever leaves your browser.
Accepts standard or URL-safe Base64, with or without = padding, line breaks or a data: prefix.
This doesn’t decode to readable text.
The file type is detected from the decoded bytes, so you get the right extension even without a data: prefix.
- Detected type
- MIME type
- Size
🔒 Everything runs in your browser. Your text and files are never uploaded.
Free Base64 Encoder and Decoder
This free Base64 encoder and decoder converts text or any file to Base64, and turns Base64 back into readable text or the original file. It handles UTF-8 and emoji correctly, can produce URL-safe Base64, and detects the file type when you decode. Everything runs in your browser, so your data is never uploaded.
What is Base64?
Base64 is a way to write any data, including images, PDFs and other binary files, using only 64 plain text characters: A–Z, a–z, 0–9, plus (+) and slash (/). The equals sign (=) is added at the end as padding when needed. The result can travel safely through systems that only accept text, such as email, JSON, XML and HTML.
Base64 works on groups of 3 bytes. Those 24 bits are split into four 6-bit pieces, and each piece becomes one character. For example, the text “Hi!” is the 3 bytes 72, 105 and 33. Split into 6-bit pieces they become 18, 6, 36 and 33, which are the characters S, G, k and h, so “Hi!” encodes to SGkh. When the last group has only 1 or 2 bytes, the output is padded with = signs, so “Hi” becomes SGk=.
Since every 3 bytes become 4 characters, Base64 text is about 33% larger than the original data. The tool shows the input size, the output size and the size change as you work.
How to encode text to Base64
- Open the Text tab and choose Encode.
- Type or paste your text into the Text to encode box. The Base64 appears instantly below it.
- Optionally turn on URL-safe (base64url) or Split lines every 76 characters.
- Click Copy to copy the result, or Download .txt to save it.
How to decode Base64 to text
- Open the Text tab and choose Decode.
- Paste your Base64 into the Base64 to decode box. The decoded text appears instantly.
- If you have several Base64 values, one per line, turn on Decode each line separately.
- Click Swap at any time to move the output into the input and switch direction.
How to convert a file to Base64 and back
- Open the File tab and choose File → Base64.
- Drop a file onto the box or click it to choose one. Any file type up to 50 MB works.
- Turn on Include data URI prefix if you need a ready-to-use data: URI, then copy or download the Base64.
- To go the other way, choose Base64 → File and paste Base64 or a data URI. The tool detects the file type, previews images and lets you download the file with the right extension.
Features
Full UTF-8 and emoji support
Text is converted to UTF-8 bytes first, so “Hello, Emma! 🚚” or “日本語” encodes and decodes exactly. Prefer the older single-byte format? Set the Character set to Latin-1 (ISO-8859-1).
URL-safe Base64
Turn on URL-safe (base64url) to replace + with a hyphen (-), / with an underscore (_) and drop the = padding. That output can go straight into URLs, file names and tokens such as JWTs.
MIME line splitting
Split lines every 76 characters breaks the output into 76-character lines, the line length used for email attachments (MIME).
A forgiving decoder with clear errors
The decoder ignores spaces and line breaks, removes a data: prefix, accepts both the standard and URL-safe alphabets and adds missing padding for you. If something is really wrong, it tells you exactly what and where, for example an invalid character at position 15, or a length that can’t be valid Base64.
Binary data, hex dump and Latin-1 view
If decoded bytes aren’t valid UTF-8 text, the tool says so instead of showing garbled characters. It also tells you what the data looks like, such as a PNG image, and lets you Show hex dump, Show as Latin-1 or download the bytes as a file.
File type detection and image preview
When you decode to a file, the tool reads the first bytes to detect the type, including PNG, JPEG, GIF, WebP, BMP, ICO, SVG, PDF, ZIP, GZIP, MP3, MP4, WAV, OGG, XML, JSON and plain text. Images get a preview, and the download name gets the matching extension.
Large files
Files up to 50 MB are encoded right in your browser. For very long results, the box shows the first 200,000 characters to keep the page fast, while Copy and Download .txt include the full text.
Base64 vs. URL-safe Base64
Standard Base64 uses + and /, which have special meanings in URLs and file paths. URL-safe Base64 (also called base64url, defined in RFC 4648) swaps them for a hyphen (-) and an underscore (_), and usually leaves out the = padding. When decoding, this tool accepts either form, so you don’t need to know which one you have.
Common uses of Base64
- Embedding small images, icons and fonts in HTML or CSS as data URIs
- Sending file attachments in email (MIME)
- Putting binary data, such as images or keys, inside JSON or XML
- HTTP Basic authentication headers
- The header and payload parts of JSON Web Tokens (JWTs)
- PEM files for SSL certificates and keys
Decoding a JSON Web Token? Each part of a JWT is URL-safe Base64, and our JWT Decoder & Encoder splits the token, decodes the header and payload and checks the signature for you. To make text safe for a URL query string, use URL encoding (percent-encoding) instead of Base64.
Base64 is encoding, not encryption
Base64 doesn’t hide or protect anything. Anyone can decode it in a second, and there’s no key or password involved. Never use it to protect passwords, API keys or personal information; use real encryption instead.
Is it private?
Yes. The Base64 encoder and decoder runs entirely in your web browser. Your text and files are converted on your own device and are never sent to our server or anyone else. The tool remembers your settings, such as the character set and URL-safe option, but it doesn’t save your text or files.
Frequently asked questions
Is this Base64 encoder and decoder free?
Yes. It’s completely free, with no sign-up and no limit on how many times you use it.
Does it support UTF-8 and emoji?
Yes. Text is converted to UTF-8 bytes before encoding, so accented letters, non-Latin scripts and emoji encode and decode correctly. You can switch the character set to Latin-1 (ISO-8859-1) if you need single-byte output.
How do I convert a file to Base64?
Open the File tab, choose File → Base64 and drop in any file up to 50 MB. Turn on Include data URI prefix if you need a data: URI, then copy or download the result.
How do I turn Base64 back into a file?
Open the File tab, choose Base64 → File and paste the Base64 or data URI. The tool detects the file type, shows a preview for images and lets you download the file with the right extension.
What is URL-safe Base64?
URL-safe Base64, or base64url, replaces + with a hyphen and / with an underscore, and usually drops the = padding, so the result can be used in URLs and file names. This tool can create it, and it decodes both forms automatically.
Why does my Base64 show “invalid character” or “impossible length”?
Base64 only uses A–Z, a–z, 0–9, + and / (or a hyphen and underscore in URL-safe Base64), plus = at the end. The error shows the position of the first character that doesn’t belong, often a stray quote or an invisible character from copying. An impossible length usually means a character was lost when the text was copied.
Why is the decoded text unreadable?
The Base64 probably holds a file or binary data rather than text, or text in a different encoding. The tool tells you what the data looks like and lets you view it as a hex dump or as Latin-1, or download it as a file.
Is Base64 encryption?
No. Base64 is an encoding that anyone can reverse instantly. It doesn’t use a key and doesn’t protect your data. Use real encryption to keep information secret.
Is my data uploaded anywhere?
No. All encoding and decoding happens in your browser, and your text and files never leave your device.
