Base64 Encoder
Encode text to Base64
Text Input
Base64 Output
How to use the Base64 Encoder
- •Enter your text in the input field. You can type directly or paste any text content you want to encode.
- •Select the character encoding if needed. UTF-8 is the default and handles most use cases, including international characters and emoji.
- •View the Base64 output that appears instantly in the output field as you type.
- •Copy the encoded string to your clipboard with a single click using the copy button.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. The character set consists of A-Z, a-z, 0-9, plus (+), and slash (/), with equals (=) used for padding. This makes Base64-encoded data safe to transmit through systems that only handle text, such as email (MIME), URLs, and JSON.
The encoding process works by taking three bytes (24 bits) of input at a time and splitting them into four groups of six bits each. Each 6-bit group maps to one of the 64 characters in the Base64 alphabet. If the input length is not a multiple of three bytes, padding characters (=) are appended to make the output length a multiple of four characters.
Base64 increases the size of data by approximately 33%. Three bytes of input become four characters of output, so a 3 KB file becomes about 4 KB when Base64-encoded. This overhead is the trade-off for the ability to embed binary data in text-only contexts.
It is important to understand that Base64 is an encoding, not encryption. Base64 provides no security whatsoever. Anyone can decode a Base64 string back to the original data. Never use Base64 as a way to hide sensitive information like passwords or API keys. It is merely a transport encoding to make binary data text-safe.
Common variants include "URL-safe Base64" which replaces + with - and / with _ to avoid characters that have special meaning in URLs. Some implementations also omit the padding = characters since the original length can be inferred.
Common use cases
- •Embedding images in HTML/CSS: Data URIs use Base64 to embed small images directly in HTML or CSS, eliminating the need for separate HTTP requests. For example:
data:image/png;base64,iVBOR.... - •Email attachments (MIME): The MIME standard uses Base64 to encode binary file attachments so they can be transmitted through text-based email protocols.
- •HTTP Basic Authentication: The Authorization header in HTTP Basic Auth encodes the username and password in Base64 (though this provides no actual security without HTTPS).
- •Storing binary data in JSON: When you need to include binary data (like a file or image) in a JSON payload, Base64 encoding converts it to a string value.
- •Data URIs in web development: Embedding fonts, SVGs, and small assets directly in CSS or HTML using Base64 data URIs to reduce HTTP requests.
FAQ
Is Base64 encryption? No. Base64 is an encoding scheme, not an encryption algorithm. It is trivially reversible by anyone. Do not use Base64 to protect sensitive data. Use proper encryption (like AES) for security.
Why does Base64 output end with = or ==? The equals signs are padding characters. Base64 works on groups of 3 bytes. If the input is not evenly divisible by 3, padding is added: one = if there is one extra byte, and == if there are two extra bytes.
Does Base64 work with non-ASCII text? Yes, but the text must first be encoded to bytes using a character encoding like UTF-8. This tool handles that automatically. The Base64 output represents the UTF-8 byte sequence of your text.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers. The encoding is performed using the browser's native btoa() function or equivalent, entirely on your local device.
How to use the Base64 Encoder
- Enter your text in the input field. You can type directly or paste any text content you want to encode.
- Select the character encoding if needed. UTF-8 is the default and handles most use cases, including international characters and emoji.
- View the Base64 output that appears instantly in the output field as you type.
- Copy the encoded string to your clipboard with a single click using the copy button.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. The character set consists of A-Z, a-z, 0-9, plus (+), and slash (/), with equals (=) used for padding. This makes Base64-encoded data safe to transmit through systems that only handle text, such as email (MIME), URLs, and JSON.
The encoding process works by taking three bytes (24 bits) of input at a time and splitting them into four groups of six bits each. Each 6-bit group maps to one of the 64 characters in the Base64 alphabet. If the input length is not a multiple of three bytes, padding characters (=) are appended to make the output length a multiple of four characters.
Base64 increases the size of data by approximately 33%. Three bytes of input become four characters of output, so a 3 KB file becomes about 4 KB when Base64-encoded. This overhead is the trade-off for the ability to embed binary data in text-only contexts.
It is important to understand that Base64 is an encoding, not encryption. Base64 provides no security whatsoever. Anyone can decode a Base64 string back to the original data. Never use Base64 as a way to hide sensitive information like passwords or API keys. It is merely a transport encoding to make binary data text-safe.
Common variants include "URL-safe Base64" which replaces + with - and / with _ to avoid characters that have special meaning in URLs. Some implementations also omit the padding = characters since the original length can be inferred.
Common use cases
- Embedding images in HTML/CSS: Data URIs use Base64 to embed small images directly in HTML or CSS, eliminating the need for separate HTTP requests. For example:
data:image/png;base64,iVBOR.... - Email attachments (MIME): The MIME standard uses Base64 to encode binary file attachments so they can be transmitted through text-based email protocols.
- HTTP Basic Authentication: The Authorization header in HTTP Basic Auth encodes the username and password in Base64 (though this provides no actual security without HTTPS).
- Storing binary data in JSON: When you need to include binary data (like a file or image) in a JSON payload, Base64 encoding converts it to a string value.
- Data URIs in web development: Embedding fonts, SVGs, and small assets directly in CSS or HTML using Base64 data URIs to reduce HTTP requests.
FAQ
Is Base64 encryption? No. Base64 is an encoding scheme, not an encryption algorithm. It is trivially reversible by anyone. Do not use Base64 to protect sensitive data. Use proper encryption (like AES) for security.
Why does Base64 output end with = or ==? The equals signs are padding characters. Base64 works on groups of 3 bytes. If the input is not evenly divisible by 3, padding is added: one = if there is one extra byte, and == if there are two extra bytes.
Does Base64 work with non-ASCII text? Yes, but the text must first be encoded to bytes using a character encoding like UTF-8. This tool handles that automatically. The Base64 output represents the UTF-8 byte sequence of your text.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers. The encoding is performed using the browser's native btoa() function or equivalent, entirely on your local device.