Base64 Encode and Decode Online
Base64 is a binary to text encoding that represents any data (text, images, binary files) as a string of printable ASCII characters. Paste text to encode it, or paste a Base64 string to decode it back. Everything runs locally in your browser.
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data as a string of 64 printable ASCII characters: A-Z, a-z, 0-9, +, and /. It was defined in RFC 4648 and is used whenever binary data needs to be transmitted over channels that only support text, such as email (MIME attachments), HTML/CSS (data URIs for inline images), JSON (embedding binary payloads), and URLs (query parameters containing binary data). Base64 encoding expands data by approximately 33%: every 3 input bytes become 4 Base64 characters. It is not encryption; anyone can decode a Base64 string back to its original form. Its purpose is safe transport, not confidentiality.
How to Use
- Paste or type your text into the input field
- Select a mode: Auto (detects whether to encode or decode), Encode, or Decode
- Copy the result from the output field using the Copy button
How Base64 Works
Base64 encoding converts binary data into a text representation using 64 printable ASCII characters. The encoding process takes every 3 bytes (24 bits) of input and splits them into 4 groups of 6 bits. Each 6-bit value maps to one of 64 characters: A-Z, a-z, 0-9, +, and /. If the input length is not a multiple of 3, padding characters (=) are added.
This encoding is commonly used for embedding images in HTML/CSS via data URIs, encoding email attachments (MIME), transmitting binary data in JSON or XML payloads, and storing complex data in URL parameters or cookies.
UTF-8 Support
This tool fully supports UTF-8 text, including emoji, CJK characters, and other multibyte Unicode. The input text is first encoded to UTF-8 bytes using the TextEncoder API before Base64 encoding, ensuring correct round trip conversion for any language or symbol set.
JWTs use a variant called Base64URL that swaps +/ for -_ and drops padding. The JWT Decoder handles that automatically. If you need to encode special characters for URLs instead of binary transport, the URL Encoder uses percent encoding, which is the standard for query parameters and path segments.
File and Image Conversion
This tool handles text input. To convert files and images to Base64, use the dedicated converters below. They support drag and drop, image preview, and output as plain Base64, data URIs, or CSS background declarations:
- Image to Base64: convert any image (JPG, PNG, SVG, WebP, GIF)
- PDF to Base64: encode PDFs for APIs and database storage
- File to Base64: encode any file type
- Base64 to Image: decode and preview Base64 image strings
- Base64 to File: decode Base64 back to downloadable files
- CSS Background Image: generate ready to paste CSS with inline images
- Data URI Generator: create data: URLs from any file