Base64 Encoder / Decoder
Encode text or images to Base64 and decode Base64 strings back to readable text. Runs entirely in your browser.
How to Use
Choose Text or Image Mode
Click the "Text" tab to encode or decode plain text strings. Click the "Image" tab to convert an image file into its Base64 data URL representation.
Enter Your Input
For text mode, paste any plain text to encode it, or paste a Base64-encoded string to decode it. For image mode, click the upload area and select an image from your device.
Encode or Decode
In text mode, click "Encode to Base64" or "Decode from Base64". The result appears instantly in the output area. If the input is not valid Base64, an error message is shown.
Copy the Result
Click the "Copy" button next to the output area to copy the entire result to your clipboard. For images, the full data URL (including the data:image/...;base64, prefix) is copied.
Base64 Encoder and Decoder — Convert Text and Images Online
Base64 is an encoding scheme that converts binary data into a string of ASCII characters. It's used everywhere in web development and software systems — to embed images directly in HTML or CSS, to transmit files through APIs that only accept text, and to encode credentials for HTTP Basic Authentication. This tool encodes and decodes Base64 for both text and images.
How it works
Encoding converts your text or image into a Base64 string — a long sequence of letters, numbers, plus signs, and forward slashes that represents the original data. Decoding reverses this: take a Base64 string and get back the original text or image. The encoded form is always larger than the original (by about 33%) because you're representing binary data using only 64 safe ASCII characters.
Text encoding and decoding
Type or paste any text, and the encoder converts it to Base64. This is commonly used for: encoding API keys and credentials before including them in HTTP headers, encoding strings for storage in systems that don't support special characters, and testing that a Base64 string you received decodes to the expected value.
Image encoding
Upload an image and get a Base64 data URL — something like data:image/png;base64,iVBORw0KGgo.... You can paste this string directly into an HTML <img> tag's src attribute, embed it in CSS as a background-image URL, or include it in an email template. The image becomes self-contained — no separate file request needed.
Common use cases
Embedding small images in CSS: For small icons, logos, or loading spinners, embedding as Base64 eliminates an HTTP request. For images under 5–10KB, this is usually a net win for page performance. For larger images, the size overhead and reduced cacheability make separate files better.
API development and testing: REST APIs that accept file uploads sometimes expect the file content as a Base64-encoded string in a JSON field. Encode your test file here to construct the API request manually.
Email inline images: HTML emails can embed images as Base64 so they don't rely on external servers. This is useful for transactional email templates where the logo or signature image should always be visible regardless of whether the recipient's email client blocks external images.
Debugging encoded data: If you receive a Base64 string in a log, an API response, or a JWT token payload, decode it here to see the original content.
HTTP Basic Authentication: The Authorization header for HTTP Basic Auth is the username and password joined by a colon, then Base64 encoded. Encode your credentials here to construct a manual API request for testing.
Fintech and payment APIs in India: Several payment gateway APIs (Razorpay, PayU) and banking APIs send and receive certain fields as Base64-encoded data — particularly images for KYC documents or encrypted payloads. Decode those values here for debugging.
Tips
Don't use Base64 to "secure" sensitive data. Base64 is an encoding, not encryption — anyone can decode it in seconds. It's not a security measure; it's a way to represent binary data as text.
For large images, Base64 is not the right approach. The encoded string is 33% larger than the original file, and it can't be cached independently by the browser (the whole HTML or CSS file containing it must be re-downloaded when it changes). Use separate image files for anything that needs to be cached or that's larger than a small icon.
Limitations
This tool handles text and image files. Binary file types (ZIP, PDF, executable files) can technically be Base64 encoded but the tool may not preview the decoded result meaningfully — you'd just get the raw binary data back.
Very large images take a moment to encode because the browser needs to process the full file data. Files over a few megabytes may be slow or may hit browser memory limits on lower-end devices.
Frequently Asked Questions
Base64 is an encoding scheme that converts binary data into a string of ASCII characters using a set of 64 printable characters (A–Z, a–z, 0–9, +, /). It was designed to allow binary data to be safely transmitted through text-only channels such as email bodies, JSON APIs, or HTML attributes.
Use Base64 when you need to embed binary data (like images or files) in a text-based format. Common uses include embedding small images directly in HTML or CSS as data URLs, encoding binary data in JSON API payloads, storing file attachments in email, and encoding credentials in HTTP Basic Authentication headers.
No. Base64 is an encoding scheme, not a compression algorithm. In fact, it increases the size of data by approximately 33% because every 3 bytes of binary data are encoded as 4 ASCII characters. If you need compression, use formats like gzip or Brotli before or after encoding.
No. Base64 is not encryption and provides no security. It is purely a way to represent binary data as printable text characters. Anyone can decode a Base64 string instantly — there is no key or secret involved. Never use Base64 to protect sensitive data. Use proper encryption (AES, RSA, etc.) for that purpose.
Base64 encoded data is roughly 33% larger than the original binary. For example, a 100 KB image becomes approximately 133 KB when Base64-encoded. This is because 3 bytes of input (24 bits) are represented as 4 Base64 characters (each representing 6 bits). Padding characters (=) are added to make the output length a multiple of 4.