- Overview
- Converters
- Base64 Encoder / Decoder
Base64 Encoder / Decoder
This Base64 tool encodes text to Base64 format and decodes Base64 strings back to readable text. Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters, commonly used in email, data URLs, and API authentication.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text
Frequently Asked Questions
What is Base64 encoding?
Base64 encoding is a binary-to-text encoding scheme that converts binary data into a string of 64 ASCII characters (A-Z, a-z, 0-9, +, and /). It allows binary data to be safely transmitted over text-based protocols like email (MIME), embedded in HTML/CSS as data URIs, or included in JSON and XML documents without corruption.
How does Base64 encoding work?
Base64 works by taking groups of 3 bytes (24 bits) and splitting them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters in the Base64 alphabet. If the input length is not divisible by 3, padding characters (=) are added. For example, the text 'Hi' (2 bytes) produces 'SGk=' with one padding character.
Why is Base64 used?
Base64 is used whenever binary data needs to be represented as text. Common use cases include embedding images in HTML/CSS data URLs, encoding email attachments (MIME), storing binary data in JSON or XML, HTTP Basic Authentication headers, and encoding cryptographic keys and certificates in PEM format.
What is the difference between Base64 and encryption?
Base64 is an encoding scheme, not encryption. It transforms data into a different representation but provides no security. Anyone can decode Base64 without a key. Encryption, by contrast, uses algorithms and secret keys to make data unreadable without the correct key. Base64 is for data transport compatibility, not confidentiality.
How much larger is Base64 than the original?
Base64 encoding increases data size by approximately 33%. Every 3 bytes of input produce 4 bytes of Base64 output. For example, a 3 KB file becomes approximately 4 KB when Base64 encoded. This overhead is the trade-off for representing binary data safely in text-based formats.
What is URL-safe Base64?
URL-safe Base64 replaces the standard + and / characters with - and _ respectively, and often omits the = padding. This variant is used in URLs, filenames, and other contexts where standard Base64 characters would cause problems. It is commonly used in JWT tokens, URL parameters, and file system safe identifiers.
Can Base64 encode binary files?
Yes, Base64 can encode any binary file including images, PDFs, audio, video, and executables. The file is read as raw bytes, then encoded into Base64 text. This is commonly used for embedding small images directly in HTML or CSS, attaching files to emails, and transmitting binary data through text-only APIs.
About Base64 Encoder / Decoder
The Base64 Encoder / Decoder is a versatile online tool that lets you encode text into Base64 format or decode Base64 strings back into readable text. Base64 encoding is widely used in web development, email systems, and data transmission to safely represent binary data as ASCII text. This Base64 Encoder / Decoder handles Unicode characters seamlessly, making it suitable for multilingual content.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It converts every 3 bytes of input into 4 Base64 characters, with padding (=) added when the input length is not a multiple of 3. This Base64 Encoder / Decoder uses the standard Base64 alphabet defined in RFC 4648.
How to Use the Base64 Encoder / Decoder
- Select the "Encode" tab to convert plain text to Base64, or the "Decode" tab to convert Base64 back to text
- Enter or paste your text into the input area
- The Base64 Encoder / Decoder instantly converts your input in real time
- Click the copy button to copy the result to your clipboard
- Review the size comparison to understand the encoding overhead
Common Use Cases for Base64 Encoding
- Embedding images directly in HTML or CSS using data URIs
- Encoding email attachments in MIME format
- Transmitting binary data through text-only protocols like JSON or XML
- Storing binary data in databases that only support text
- Encoding authentication credentials in HTTP Basic Auth headers
- Passing binary data in URL query parameters
How Base64 Encoding Works
The Base64 encoding process converts input data through these steps:
- The input text is converted to its binary byte representation (UTF-8)
- The binary data is split into groups of 6 bits each
- Each 6-bit group is mapped to one of the 64 Base64 characters
- Padding characters (=) are added if needed to make the output length a multiple of 4
Base64 encoding increases the data size by approximately 33%, since 3 bytes of input produce 4 bytes of output. The Base64 Encoder / Decoder displays this size comparison for every conversion.
Base64 Character Set
The standard Base64 alphabet consists of:
- A-Z (indices 0-25)
- a-z (indices 26-51)
- 0-9 (indices 52-61)
- + (index 62)
- / (index 63)
- = (padding character)
Unicode and UTF-8 Support
This Base64 Encoder / Decoder fully supports Unicode characters by first encoding text as UTF-8 bytes before applying the Base64 transformation. This means you can safely encode and decode text containing special characters, emojis, and characters from any language. The tool uses the TextEncoder and TextDecoder APIs to ensure correct handling of multibyte characters.
Tips for Working with Base64
- Base64 is an encoding scheme, not encryption — it provides no security
- Base64 encoded strings are always longer than the original data (~33% increase)
- When using Base64 in URLs, consider URL-safe Base64 which replaces + with - and / with _
- Remove any whitespace or line breaks from Base64 strings before decoding
- Valid Base64 strings have a length that is a multiple of 4 (with padding)