Base64 Decode and Encode
Convert text and Base64 in both directions, directly in your browser. The decoder accepts standard and URL-safe alphabets and fixes missing padding; you can also turn a local file into Base64.
Whitespace and line breaks are ignored when decoding. URL-safe characters (- and _) are accepted.
Encode a local file to Base64
The file is read in your browser and never uploaded. The Base64 text appears in the Result box; for large outputs only a preview is shown, but Copy and Download always use the full value.
How to use
- Paste your text or Base64 string into the Input box.
- Pick a mode: Decode turns Base64 into text, Encode turns text into Base64.
- Press Decode / Encode. The converted value appears in the Result box.
- Copy the result, download it as a .txt file, or send it back into the input for a round trip.
To encode a file, use the file picker under the converter. Its Base64 output lands in the same Result box.
Inputs and outputs
Decoding
- Accepts the standard alphabet (
+/) and the URL-safe alphabet (-_); mixing them is reported as an error. - Missing
=padding is added automatically and reported. Inputs whose length cannot be fixed by padding are rejected with an explanation. - Whitespace and line breaks (common in wrapped certificates and keys) are ignored.
- If the decoded bytes are not valid UTF-8, the tool says so and shows a hex preview instead of garbled text — the data may be binary or in another character encoding.
Encoding
- Input is encoded as UTF-8 and emitted as standard Base64 with
=padding. - Base64 output is about 33% larger than the original bytes — that is inherent to the format.
Limits
- Files: up to 5 MiB per file.
- Result box: shows the first 128 KiB of very large results as a preview; Copy and Download always use the complete value, so huge outputs never freeze the page.
- Browser: any current version of Chrome, Edge, Firefox, or Safari.
Frequently asked questions
What is Base64 used for?
Base64 represents binary data using only 64 printable ASCII characters, so it can travel through systems that only handle text safely: email attachments (MIME), data URLs in HTML and CSS, JSON web tokens, and API payloads that cannot carry raw bytes.
Is Base64 encryption?
No. It is a reversible encoding with no key — anyone can decode the output. Base64 protects nothing; it only changes how bytes are written down.
Why does my input fail to decode?
Three common reasons: an invalid character (anything outside A–Z, a–z, 0–9, +, /, -, _ and trailing =), a truncated string whose length cannot be repaired with padding, or mixing the standard and URL-safe alphabets. The error message names the character and its position when possible.
What is URL-safe Base64?
A variant that replaces + with - and / with _ so the output can be used in URLs and file names without escaping; padding is often omitted. The decoder here accepts both alphabets, with or without padding.
Why do I see "not valid UTF-8" and a hex preview?
Base64 can encode any bytes. When the decoded bytes do not form valid UTF-8 text, they are most likely binary data or text in another encoding (for example Latin-1). Instead of printing garbled characters, the tool explains this and shows the first bytes in hexadecimal so you can identify the data.
Can I encode a file into Base64?
Yes — use the file picker on this page for files up to 5 MiB. The file is read locally; only you see the result.
Is my text sent anywhere?
No. Conversion happens entirely in your browser with local JavaScript. The page loads no third-party scripts and makes no network requests with your input, so your data stays on your device.