Skip to content

Base64 encode & decode. Every byte stays on your device.

Encoding is UTF-8 safe, emoji and accented characters round-trip correctly.

Base64, without leaving the page

Type in the plain-text pane and the Base64 pane fills in as you type, UTF-8 handled correctly, so emoji and accented characters round-trip intact. Paste Base64 the other way and decode it back; the decoder tolerates URL-safe characters, data: URI prefixes, wrapped lines and missing padding automatically. Switch to the File tab to drop any file up to 25 MB and get its Base64 plus a ready-to-paste data: URI, or paste Base64 and download the original file it encodes. Everything happens locally on your device, no upload, no sign-up, and it keeps working offline.

§ · written guide

How to use the Base64 Encode/Decode tool

This tool converts text and files to Base64 and back. Text is turned into UTF-8 bytes first, so accented letters and other scripts survive the round trip, and the decoder accepts URL-safe characters, data: URIs, wrapped lines and missing padding. It is for developers working with tokens, API payloads, data: URIs and email or PEM blocks.

Step by step

  1. Encode text as you type

    On the Text tab, type or paste into the plain text pane. The base64 pane fills in about a quarter of a second after you stop typing. You can also press Encode, or Sample text to load a short UTF-8 test string.

  2. Decode Base64 back to text

    Paste Base64 into the base64 pane and press Decode. Decoding only runs when you press the button. If you then type in the plain text pane, the live encoder replaces the base64 pane again.

  3. Pick an output format

    Tick URL-safe to swap "+" and "/" for "-" and "_" and drop the = padding. Tick Wrap at 76 (MIME/PEM) to break the output into 76 character lines. Tick data: URI prefix to get a ready data:text/plain URI. When data: URI prefix is on, wrapping is skipped because a data: URI must stay on one line.

  4. Copy or reset

    Press Copy text or Copy Base64 to copy either pane. Press Clear to empty both panes and start again.

  5. Encode a file

    Switch to the File tab and drop a file on Drop a file, or click it to browse. Any type works, up to 25 MB. You get the Base64 and a data: URI built from the file type, each with its own Copy button, plus Download .txt of Base64 for long outputs.

  6. Turn Base64 back into a file

    On the right of the File tab, under Base64 → File, paste the Base64 or a full data: URI. Set the output filename (the default is decoded.bin) and press Decode & download.

Reading the result

  • The small counter above the plain text pane shows its size in UTF-8 bytes, and the one above the base64 pane shows the number of Base64 characters. Hello is 5 B and encodes to SGVsbG8= at 8 chars, or SGVsbG8 with URL-safe on.
  • Base64 is always about a third larger than the input, because every 3 bytes become 4 characters, padded with = to a multiple of 4.
  • If the decoded bytes are not valid UTF-8 text, the plain text pane shows a hex preview of the first 64 bytes instead of garbled characters. That means the Base64 holds a file, so decode it on the File tab.
  • After you add a file, the line under its name shows the file size, its type and the length of the Base64. After Decode & download, the line under the button shows the decoded size and the filename used.

Tips and common mistakes

  • Base64 is an encoding, not encryption. Anyone can decode it, so do not treat a Base64 string as a way to hide a password or key.
  • Use URL-safe for anything that goes into a URL, a JWT or a filename. Use the standard alphabet for data: URIs, basic auth headers and email.
  • When you paste a data: URI for a PNG, JPEG, GIF, WebP, SVG, PDF, JSON, plain text, ZIP or CSV file, the output filename extension is filled in for you as long as the name still starts with decoded.
  • Keep data: URIs for small assets such as icons. They are a third larger than the file and cannot be cached on their own.
  • Wrap at 76 (MIME/PEM) also applies to the file Base64 and the downloaded .txt, but never to the data: URI. URL-safe and data: URI prefix only change the Text tab output; file Base64 always uses the standard alphabet.

Privacy and limits

Encoding and decoding run in your browser with its built-in Base64, TextEncoder, TextDecoder and FileReader functions. Nothing you paste or drop is uploaded, and nothing is saved after you close the tab. Files over 25 MB are refused.

Back to the tool

§ 02 · what you can do

Every Base64 job, one page.

  • Encode any text to Base64 in real time, with full UTF-8 support for emoji, accented letters and non-Latin scripts.
  • Decode Base64 back to plain text, automatically handling URL-safe characters, data: URI prefixes and missing padding, with a hex preview instead of mojibake when the bytes are binary.
  • Convert any file to Base64 by dropping it on the File tab, with an instant preview for image files.
  • Generate a data: URI from any file, ready to paste into HTML, CSS or Markdown with no extra HTTP request.
  • Download a decoded file by pasting Base64 or a full data: URI and clicking Decode & download, the filename extension is even suggested from the MIME type.
  • Switch to URL-safe mode for JWTs, OAuth tokens and signed URLs, or wrap output at 76 characters for MIME and PEM blocks.
§ 04 · faq

Frequently asked questions.

Is the data I paste sent anywhere?
No. The tool uses the browser's native btoa, atob, TextEncoder, TextDecoder and FileReader APIs, all running client-side on this page. No network request carries your content, safe for API keys, JWT secrets, encoded credentials or any sensitive value you don't want uploaded to a third party.
What's the difference between standard and URL-safe Base64?
Standard Base64 (RFC 4648 §4) uses A-Z, a-z, 0-9 plus '+' and '/'. The plus and slash break URL parameters and filenames, so URL-safe Base64 (RFC 4648 §5) substitutes '-' and '_' and usually drops the trailing '=' padding. Use URL-safe when the output goes into a URL, JSON Web Token, OAuth state parameter or filename; use standard everywhere else (data URIs, basic-auth headers, file embedding). The decoder here accepts both, with or without padding.
Why is my decoded UTF-8 garbled?
If the original was encoded as Latin-1 or another non-UTF-8 charset, decoding as UTF-8 produces mojibake. This tool decodes with TextDecoder('utf-8') in strict mode, the correct choice for modern Base64, and shows a hex preview instead of garbled characters when the bytes are not valid UTF-8. If you know the source used a legacy charset, convert at the source.
How do I encode a binary file?
Switch to the File tab and drop the file onto the dropzone, or click it to browse (any type, up to 25 MB). The tool reads the raw bytes via FileReader and Base64-encodes them locally. You get the Base64 string and a data: URI built from the file's MIME type, each with its own copy button, plus a "Download .txt of Base64" option for large outputs.
What's the "Wrap at 76" option for?
Some legacy contexts (MIME email bodies, PEM-encoded keys, S/MIME) require Base64 wrapped at 76 characters per line, which is what tools like OpenSSL emit by default. Modern HTTP, JSON and JWT all use single-line Base64, so unwrapped is the default here. The wrap applies to text-mode output, the file-mode Base64 pane and the downloaded .txt alike, data: URIs always stay single-line.
Why does Base64 of a 100-byte string take 136 characters?
Base64 encodes every 3 input bytes as 4 output characters, a fixed ~33% size overhead, plus '=' padding to a multiple of four. So 100 bytes become 136 characters (132 data + 4 padding). That's the cost of representing binary data using only printable-ASCII-safe characters. For larger payloads, compress the binary first, then Base64 it.

Published · Last updated .

Priya sent you a message Online now

Talk to a Developer Now

Share your name and email to reply.

Reply