Base64 Encoder/Decoder
Encode text or files to Base64 format, or decode Base64 strings back to text.
Safe conversion with no data sent to server
Last updated: March 2026
Upload a file to encode it to Base64
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It works by translating every three bytes of binary data into four characters from a set of 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /). The name "Base64" directly refers to this 64-character alphabet. When the input length is not a multiple of three, padding characters (=) are appended to the output to maintain the 4-character block structure.
Base64 encoding was originally designed for transferring binary data over channels that only support text, such as email (MIME) and older HTTP protocols. Today it remains essential in web development for embedding images directly in HTML or CSS via data URIs, transmitting binary payloads in JSON APIs, encoding authentication credentials in HTTP Basic Auth headers, and storing binary blobs in text-based configuration files like XML or YAML.
While Base64 increases data size by approximately 33% compared to the raw binary, this overhead is an acceptable trade-off when text-safe transport is required. It is important to note that Base64 is an encoding scheme, not an encryption method. It provides no security or confidentiality; anyone can decode a Base64 string back to its original form.
How to Use This Base64 Tool
To encode text to Base64:
- Select the "Encode" mode at the top of the tool.
- Type or paste your plain text into the Input field.
- Click "Encode to Base64" to generate the encoded output.
- Use the Copy or Download button to save your result.
To encode a file to Base64:
- With Encode mode selected, use the file upload area to select any file (images, PDFs, etc.).
- The tool will automatically read the file and produce a Base64 data URI string.
- Copy the output to embed it in HTML, CSS, or your application code.
To decode Base64 back to text:
- Switch to "Decode" mode.
- Paste your Base64 string into the Input field.
- Click "Decode from Base64" to reveal the original content.
Common Use Cases
- Embedding images in HTML/CSS: Convert small images (icons, logos) to Base64 data URIs to reduce HTTP requests and improve page load performance.
- HTTP Basic Authentication: Encode username:password pairs in Base64 for the Authorization header in API requests.
- Email attachments (MIME): Binary attachments in emails are encoded in Base64 so they can travel through text-only SMTP protocols.
- JSON API payloads: Safely transmit binary content (PDFs, certificates, images) within JSON objects by encoding them as Base64 strings.
- Data URIs in web apps: Generate inline data URIs for fonts, SVGs, or small assets without requiring separate file downloads.
- Storing binary in text configs: Embed cryptographic keys, certificates, or small binary payloads in YAML, XML, or .env configuration files.
- Clipboard sharing: Encode binary data to safely copy and paste it across text-based communication channels like Slack or email.
FAQ
Is Base64 encoding the same as encryption?
No. Base64 is a reversible encoding scheme, not encryption. Anyone can decode a Base64 string without a key. If you need to protect sensitive data, use proper encryption algorithms (AES, RSA) before optionally Base64-encoding the ciphertext for safe transport.
Why does Base64 output appear larger than the original?
Base64 encoding inflates the data size by approximately 33%. Every 3 bytes of input become 4 characters of output, plus potential padding. This overhead is the cost of representing binary data in a text-safe alphabet of only 64 characters.
Is my data sent to a server when using this tool?
No. All encoding and decoding happens entirely in your browser using JavaScript. Your data never leaves your device, making this tool safe for sensitive content like API keys or personal information.
What is the difference between standard Base64 and URL-safe Base64?
Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 (also called Base64url) replaces + with - and / with _, making the output safe for use in URL parameters and filenames without additional encoding.