Base64 Decode and Encode Tool
Converts text and files to Base64 and back entirely in the browser, with nothing uploaded. A selectable character set covers UTF-8, UTF-16LE and BE, Windows-1252, Windows-1251, Windows-1254, the ISO-8859 sets, KOI8-R, KOI8-U, and IBM866 in both directions, plus Shift_JIS, EUC-JP, EUC-KR, GB18030, and ISO-2022-JP for decoding. An optional URL-safe alphabet swaps + and / for - and _, and the decoder tolerates missing padding, whitespace, and URL-safe characters without an explicit toggle. Files up to 8 MB encode from their raw bytes, so PNG, SVG, and other binary converts exactly for data URI work. Live counters report input bytes, output bytes, and encoded length.
This tool sends nothing over the network. Everything you enter is processed on your device and never reaches our servers.
Documentation
Base64 represents binary data as printable text, and this tool converts text and files to and from that representation for web development, API testing, security reviews, and data embedding. Encoding produces Base64 strings for HTML, CSS, JSON, or HTTP headers. Decoding reads Base64 back as text, including the URL-safe variants used in JWTs and query strings. Files are read locally in the browser; no part of them is uploaded anywhere.
Encoding and decoding share one input box, and the tool can infer which direction is needed from the content pasted in; choosing a mode directly locks that inference off until the box is cleared. Settings hold the character set, the URL-safe alphabet (- and _ in place of + and / for a web context), and an option to process each line separately for logs and CSV fields, and changing any of these reconverts whatever is already in the box.
Files up to 8 MB drop in directly, covering TXT, JSON, CSV, XML, HTML, MD, LOG, SVG, PNG, BIN, and B64. In Encode mode a file converts from its own bytes, so binary encodes exactly; because binary cannot be shown in a text box, its contents stay out of the input and only the Base64 result appears. In Decode mode a file has to already be Base64 text. Decoding accepts missing padding, ignores whitespace, and reads URL-safe characters without a separate setting. Counters below the result report input size, output size, and encoded length.
Generate a data URI from a small PNG or SVG icon: encode it, prefix the result with data:image/png;base64, or data:image/svg+xml;base64,, and use the whole string in CSS as a background-image. Encoding pasted SVG markup works the same way. Decode a webhook sample to inspect its JSON payload before writing parser logic. A JWT segment decodes as pasted, since the decoder reads Base64URL and missing padding with no setting changed. Build an HTTP Basic Authorization header by encoding username:password, then prefixing the result with Basic. Re-encoding a Windows-1252 or KOI8-R string under that character set keeps the bytes matched to the system receiving them. A binary file becomes Base64 to move through a channel that carries only text.
The Input bytes, Output bytes, and Encoded length counters confirm expected sizes. Encoded Base64 runs about 33 percent longer than the original bytes, padded with = so the length is a multiple of 4. URL-safe output is interchangeable with standard Base64 once - becomes + and _ becomes /. Garbled decoded text usually means the character set is wrong; UTF-8 is the first thing to try, followed by the single-byte set the data actually came from. When decoded bytes are not text at all, the result says so rather than presenting the damage as a clean reading, since a text box can only show a lossy view of binary.
What is Base64 used for? Base64 represents binary data as text for safe transport in JSON, HTML, URLs, and headers. It prevents corruption from systems that do not handle raw bytes.
What is URL-safe Base64? URL-safe Base64 replaces + and / with - and _ so strings pass through URLs and cookies without encoding issues.
Why does padding appear? Padding with = aligns the output to 4-character blocks. Some systems omit it, and decoding restores it automatically.
How is unreadable text after decoding fixed? Select the character set the data was written in. Most modern data is UTF-8; legacy systems often need Windows-1252, Windows-1251, or one of the ISO-8859 sets.
Why can some character sets only decode? Browsers ship decoders for every set in the menu but encoders for only some. Shift_JIS, EUC-JP, EUC-KR, GB18030, and ISO-2022-JP are decode-only for that reason, and encoding with them is refused rather than silently substituted with UTF-8.
Can decoded binary be saved as a file? No. Decoding shows text, so a Base64 payload that is not text can be inspected but not downloaded. Encoding in the other direction handles binary files in full.
Are files uploaded? No. Reading, encoding, and decoding all happen in the browser, and nothing is sent to a server.
Encoding follows the pipeline text → bytes (charset) → Base64. Decoding reverses it: Base64 → bytes → text (charset). The standard alphabet is A-Z a-z 0-9 + /; the URL-safe alphabet is A-Z a-z 0-9 - _. Input bytes group into 24-bit blocks, split into four 6-bit indices, map to the alphabet, and take = padding to reach a multiple of 4. Encoded length is estimated with 4 × ceil(n_bytes ÷ 3).
Inputs, outputs, and what the Base64 Decode and Encode Tool computes
What the Base64 Decode and Encode Tool asks for and what it returns, as a plain list. Defaults, units, and ranges are the ones the form loads with.
Inputs
- Mode · default: Decode
- Source character set · default: UTF-8 (ASCII compatible)
- Process each line separately · default: off
- Use URL-safe Base64 · default: off
- Enable live mode · default: off
- Enable teach mode · default: off
- Input text for conversion
- Result
Controls
Decode · Reset · Copy result
Example
Generate a data URI from a small PNG or SVG icon: encode it, prefix the result with data:image/png;base64, or data:image/svg+xml;base64, , and use the whole string in CSS as a background-image .