Base64 Encode / Decode — Text, File & Data URI
Encode or decode Base64 and Base64url text, convert a file or image to a Base64 data URI, or download Base64 back to a file—in your browser.
How it works
- Text mode supports Standard Base64 (+ / with padding) and Base64url (- _ without padding). File mode reads a local file or image as a Base64 data URI; download mode turns Base64 or a data URI back into a file. Nothing is uploaded.
About Base64 encoding
How Base64 encoding works
Base64 encodes bytes as text using 64 ASCII characters (A–Z, a–z, 0–9, + and /), so every 3 bytes become 4 characters and the output is about 33% larger; = signs pad the end so its length is a multiple of 4 characters. Text is encoded as UTF-8 first, so emoji and accented characters round-trip through Encode and Decode unchanged.
Base64url (RFC 4648 §5) swaps + and / for - and _ and usually drops the padding, which makes the output safe in URLs and JWTs; the Base64url alphabet in this tool does the same. Data URIs (data:image/png;base64,...) embed small files directly in HTML and CSS.
Base64 examples
- JavaScript (UTF-8 text)
btoa(String.fromCharCode(...new TextEncoder().encode("héllo"))) // "aMOpbGxv"- Command line
echo -n 'hello' | base64 aGVsbG8=- Python
base64.b64encode("hello".encode()).decode() # aGVsbG8=
Base64 FAQ
- How do I convert a string to Base64?
- Paste your text into the input and press Encode. The text is first encoded as UTF-8 and then Base64-encoded, so accented characters and emoji survive the round-trip.
- Is Base64 encryption?
- No. Base64 is an encoding, not encryption — anyone can decode it without a key, so never use it to hide passwords or secrets.
- What is the difference between Base64 and Base64url?
- Base64url (RFC 4648 §5) swaps + and / for - and _ so the output is safe in URLs and file names, and it usually drops the = padding. JWTs always use Base64url.
- Why does Base64 end with = or ==?
- The = signs are padding. Encoding works on 3-byte groups, and when the last group is incomplete the output is padded with = or == so its length is a multiple of 4 characters: one = when the last group has 2 bytes, == when it has 1.
- Is my data uploaded?
- No. Encoding and decoding run entirely in your browser, for pasted text and for files loaded in File → Base64 mode — nothing is sent to a server.