What Is Base64?
Base64 is an encoding scheme that converts binary data into a string of printable ASCII characters. It was designed to safely transmit binary content (such as images, files, or arbitrary bytes) through systems that only handle text, such as email protocols, JSON APIs, and HTML attributes.
Base64 is not encryption. It does not provide confidentiality or security. Anyone can decode a Base64 string instantly. Its purpose is purely to make binary data safe for text-based transmission.
What This Tool Does
This tool encodes plain text to Base64 and decodes Base64 strings back to plain text. It handles the full Unicode character range by using UTF-8 encoding internally before applying Base64, ensuring that non-ASCII characters (accents, emoji, non-Latin scripts) are handled correctly.
- Encode inputs: Any plain text string, including Unicode characters
- Encode outputs: A Base64 string using the standard alphabet (A-Z, a-z, 0-9, +, /) with = padding
- Decode inputs: A valid Base64 string
- Decode outputs: The original plain text
How the Encoding Works
Base64 works by grouping the binary data into 6-bit chunks and mapping each chunk to one of 64 printable characters. The character set is: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), / (63). If the input is not a multiple of 3 bytes, = padding is added to complete the final group.
Every 3 bytes of input = 4 Base64 characters
Output size = ceil(input bytes / 3) × 4 characters
This means Base64 always increases data size by approximately 33%. For example, a 3-byte (24-bit) input becomes 4 characters (32 bits). A 1 MB binary file encodes to approximately 1.33 MB of Base64 text.
How to Use the Tool
- Select the Encode tab to convert plain text to Base64
- Paste or type your text in the input area
- Click Encode to see the Base64 output
- Use the Copy button to copy the result to your clipboard
- Switch to the Decode tab to convert a Base64 string back to plain text
- Paste the Base64 string and click Decode
Example Encoding
Example 1: Simple Text
The text "Hello" encodes to "SGVsbG8=". Breaking it down: H=72, e=101, l=108, l=108, o=111. These 5 bytes become the groups 010010 000110 010101 101100 011010 110110 111000 (padded), mapping to S, G, V, s, b, G, 8, = in the Base64 alphabet.
Example 2: JSON Data
The JSON string {"user":"admin","role":"superuser"} encodes to "eyJ1c2VyIjoiYWRtaW4iLCJyb2xlIjoic3VwZXJ1c2VyIn0=". This is commonly seen in JWT (JSON Web Token) payloads where the header and body are Base64url-encoded JSON objects.
Real-World Scenarios
Embedding Images in HTML or CSS
Small images can be embedded directly in HTML or CSS as Base64 data URIs, eliminating an additional HTTP request. A small icon encoded as Base64 can be placed directly in a stylesheet: background-image: url("data:image/png;base64,iVBORw0K...").
API Authentication Headers
HTTP Basic Authentication encodes the username and password as Base64 in the Authorization header: "Authorization: Basic dXNlcjpwYXNzd29yZA==". Developers use this tool to manually construct or debug these headers without needing a code environment.
JWT Token Inspection
JSON Web Tokens (JWTs) consist of three Base64url-encoded sections separated by dots. Pasting the middle section (the payload) into the decode tab reveals the token's claims without needing a dedicated JWT debugger.
Why This Tool Matters
Base64 encoding is a daily tool for web developers, API integrators, and security analysts. Being able to quickly encode and decode strings without writing code speeds up debugging, API testing, and content inspection tasks.
Common Mistakes to Avoid
- Confusing Base64 with encryption: Base64 provides zero security. Never treat a Base64-encoded string as hidden or protected information. It is trivially reversible
- Removing padding characters: The = padding at the end of a Base64 string is required for correct decoding. Removing it may cause errors depending on the decoder
- Using Base64url vs standard Base64: Some applications (JWTs, URL-safe encoding) use a variant that replaces + with - and / with _, and omits padding. Standard decoders may fail on these variants
- Encoding already-encoded data: Encoding a Base64 string again produces a valid but double-encoded result. Always decode from the original Base64 rather than encoding an already-encoded value