DevTools Hub

Base64 Encoder/Decoder

Convert text and files to and from Base64, including emoji and non-English text.

Input
Output

Guide

About Base64

What Base64 is for

Base64 represents binary data using 64 safe characters: A-Z, a-z, 0-9, + and /, with = for padding. It lets bytes travel through systems designed for text, such as email (MIME attachments), JSON APIs, HTML data URLs and HTTP Basic authentication headers.

Every 3 bytes become 4 characters, so Base64 output is about 33% larger than the original. That is why embedding large images as data URLs usually makes pages slower, not faster.

Standard vs. URL-safe Base64

The + and / characters have special meanings in URLs and file names. The URL-safe variant (RFC 4648 section 5) replaces them with - and _ and usually drops the = padding. JSON Web Tokens use this form. The decoder here accepts both.

Base64 is not encryption

Base64 is an encoding, not a security measure: anyone can decode it instantly. Credentials in an HTTP Basic Authorization header, for example, are only protected by HTTPS, not by the Base64 encoding.

Frequently asked questions

Why does decoding sometimes produce garbled text?

The data may not be text at all (an image or compressed file, for example), or it may have been encoded from a different character set. This tool encodes and decodes using UTF-8.

Why do other tools break on emoji?

The browser's built-in btoa function only handles Latin-1 characters. This tool converts text to UTF-8 bytes first, so any language and emoji work.

What is a data URL?

A data URL embeds a file directly in a link, like data:image/png;base64,iVBOR... It is handy for tiny icons in CSS or HTML, but large files are better served as normal files.