Base64 Encoder & Decoder
About this tool
About Base64 Encoder
Turn any text or file into Base64 and back again without sending a single byte to a server. Text is converted to UTF-8 first, so accented letters, Hindi, Chinese and emoji survive the round trip, which plain btoa() in a browser console gets wrong. Switch Input to File to encode an image, PDF, font, certificate or ZIP, or to paste Base64 and download it as a file: the tool reads the first bytes to work out whether it is a PNG, JPEG, PDF, ZIP and so on, and names the download to match. Encoding options cover the variants you meet in practice: the URL-safe alphabet from RFC 4648 (- and _ instead of + and /) used by JWTs and many APIs, optional = padding, line breaks every 76 characters for MIME email or every 64 for PEM keys, and a ready-made data: URL. The decoder accepts all of these at once and points to the exact position of any invalid character.
Built and maintained by Abhi JainUpdated
How to Encode and Decode Base64
- 1
Pick a direction
Choose Encode or Decode, and Text or File as the input (or output when decoding).
- 2
Add your data
Type or paste text, click Sample, or drop a file. The result updates as you type.
- 3
Set the format
When encoding, choose Line breaks and tick URL-safe, = padding or Data URL as needed.
- 4
Copy or download
Copy the result, download it, or click Swap to reverse the conversion and check the round trip.
Base64 Encoder: questions and answers
What is Base64 used for?
Base64 represents binary data with 64 printable ASCII characters so it can travel through systems built for text: email attachments (MIME), data: URLs in HTML and CSS, JSON fields, HTTP Basic auth headers, JWTs and PEM certificates.
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. Use the Hash Generator for checksums and real encryption for secrets.
Why is Base64 about 33% bigger than the original?
Every 3 bytes (24 bits) become 4 characters of 6 bits each, so the output is 4/3 of the input, plus up to two = padding characters. Line breaks add a little more.
What is URL-safe Base64?
RFC 4648 section 5 defines a variant that uses - and _ instead of + and /, so the result can sit in a URL or file name without percent-encoding. Padding is often dropped as well. JWTs use this form.
Why does my decoded text show strange characters?
The data was probably not UTF-8 text: it may be an image, a compressed file or text in another encoding. The tool warns you and detects common file types, so switch Output to File to download it.
Ready-made Base64 Encoder presets
Related Tools
- Image to Base64Convert an image to a Base64 data URI with CSS, HTML and Markdown snippets, or Base64 back to an image.
- Base32 EncoderEncode and decode Base32 (RFC 4648), Base32hex and Crockford Base32, for text or raw bytes.
- URL EncoderPercent-encode and decode URLs and query values with encodeURIComponent, encodeURI or form encoding.
- JWT DecoderDecode a JWT, read its claims in human time and verify the signature with a secret or public key.
- Text to HexConvert text to hexadecimal UTF-8 bytes or code points, and hex back to text.