About this Base64 encoder
Base64 turns any bytes into plain ASCII letters, digits, and two symbols, so binary data can travel through systems that only handle text: JSON and XML payloads, email attachments, data URIs for images in HTML and CSS, and HTTP Basic authentication headers. This encoder converts text as UTF-8, so accents, Chinese characters, and emoji encode correctly, and it can encode any file without uploading it. Choose URL-safe Base64 for URLs, file names, and JWTs, or MIME Base64 for email, which wraps lines at 76 characters.
How to encode Base64
- Add text or a file. Type or paste text, press an example, or press Encode a file to encode any file in your browser.
- Choose the variant. Standard fits most uses, URL-safe fits URLs and tokens, and MIME fits email. Remove line breaks first if they should not be part of the data.
- Press Encode to Base64. The Base64 string appears with its size and a step-by-step view of the first three bytes.
- Copy or download. Press Copy Base64, or Download to save it as a text file.
Frequently asked questions
Why is the Base64 output longer than my text?
Base64 turns every 3 bytes into 4 characters, so the result is about 33% larger, plus up to two = signs of padding at the end. Accented letters, CJK characters, and emoji take 2 to 4 bytes each in UTF-8, so they grow more.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / and pads with =. Those characters have special meanings in URLs, so URL-safe Base64 uses - and _ instead and drops the padding. JWTs use URL-safe Base64.
How do I create an HTTP Basic Authorization header?
Encode username:password (with the colon) and put the result after "Basic ", for example Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=. Base64 is not encryption, so only send it over HTTPS.
Is Base64 encryption?
No. Anyone can decode Base64 in one step. It changes how data is written, not who can read it.
Is my file uploaded when I encode it?
No. The file is read and encoded by your browser, so it never reaches our server. Very large files can take a moment and make the result box slow to scroll.