Base64 Encode and Decode
Encode text to Base64 and decode Base64 strings back to readable text, with full UTF-8 support.
Base64 Encode and Decode tool
Example
Input: Hello, World!
Result: SGVsbG8sIFdvcmxkIQ==
The 13 UTF-8 bytes are split into 6-bit groups and mapped to the Base64 alphabet. The == padding appears because 13 is not a multiple of 3.
Base64 Encoding Examples
| Text | UTF-8 bytes | Base64 |
|---|---|---|
| A | 1 | QQ== |
| Hi | 2 | SGk= |
| abc | 3 | YWJj |
| Hello | 5 | SGVsbG8= |
| user:pass | 9 | dXNlcjpwYXNz |
| café | 5 | Y2Fmw6k= |
| € | 3 | 4oKs |
Produced by this tool. Padding depends on the byte count, not the letter count.
- To encode, type or paste your plain text into the Text panel.
- The Base64 string appears instantly in the Base64 panel as you type.
- To decode, paste a Base64 string (standard or URL-safe, with or without padding) into the Base64 panel.
- Read the decoded text in the Text panel, or check the error message if the string is not valid Base64.
- Use the swap button to move the Base64 result into the Text panel if you want to encode it again.
- Click the copy button above either panel to copy its contents to your clipboard.
How Base64 Encoding Works
Base64 turns any data into text made from 64 safe characters: A to Z, a to z, 0 to 9, + and /. This tool encodes text to Base64 and decodes Base64 back to text, so Hello becomes SGVsbG8= and back again. The encoder works on bytes, not letters. Your text is first turned into UTF-8 bytes. Every 3 bytes (24 bits) are then split into four 6-bit groups, and each group picks one of the 64 characters. When the input is not a multiple of 3 bytes, one or two = signs pad the end. That is why the output is always about a third larger than the input: 3 bytes in, 4 characters out.
You meet Base64 in email attachments, data URLs, JSON Web Tokens and HTTP Basic Auth headers, where the value is username:password in Base64. It is not encryption. Anyone can decode it in a second, so never treat a Base64 string as hidden. For real protection, use Text Encryption and Decryption.
The decoder is forgiving. It ignores spaces and line breaks, accepts the URL-safe alphabet that uses - and _ instead of + and /, and adds missing padding. The encoder always writes standard Base64 with padding. This tool handles text only. To turn a picture into a data URL, use the Image to Base64 Converter.
Sources
Frequently Asked Questions
Related Tools
URL Encode and Decode
Encode special characters for URLs or decode percent-encoded strings back to readable text.
Developer ToolsHTML Entity Encode and Decode
Convert special characters to HTML entities and decode HTML entities back to readable text.
Developer ToolsHash Generator
Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text or files right in your browser.
Developer ToolsJWT Decoder
Decode JSON Web Tokens to inspect header, payload, and signature without needing the secret key.
Developer Tools