These tools handle those variants explicitly and show you which alphabet is in use. The image converter produces a data URI with a preview, so you can see the result before pasting it into HTML or CSS.
Encoding Tools
Encoding is not encryption, and most encoding bugs come from mixing the variants. Standard Base64 uses `+` and `/`, which break in URLs; URL-safe Base64 swaps them for `-` and `_`. `btoa` assumes Latin-1, so Chinese text throws or turns into mojibake unless you encode UTF-8 bytes first.
What people use these for
- Decode a JWT segment or an API token that uses URL-safe Base64.
- Embed a small icon as a data URI without a build step.
- Escape a query value that contains `&`, `#` or spaces.
- Turn encoded HTML back into readable text without executing it.
Tools in this family
6 interactiveBase64 Encode
Encode text to Base64 in the browser. Handles Unicode correctly, offers URL-safe output, and shows the encoded length and padding.
Base64 Decode
Decode Base64 back to readable text with correct UTF-8 handling. Accepts missing padding and URL-safe alphabets, and reports invalid input.
URL-Safe Base64
Encode text with the URL-safe Base64 alphabet (- and _ instead of + and /). Learn where the variant is required and how padding is handled.
Image to Base64
Convert a local image to a Base64 data URI for embedding in HTML or CSS. See the mime type, encoded size, and a ready-to-paste snippet.
URL Encoder
Percent-encode or decode URL components. Choose between component encoding and full-URI encoding, and see exactly which characters are escaped.
HTML Entities
Escape HTML special characters to entities or decode entities back to text. Prevent markup injection and read encoded content safely.
Encoding is not secrecy
Base64 is reversible by anyone and adds no protection. It is used to move binary data through text channels, not to hide it. If you need confidentiality, encrypt the data; if you need integrity, sign it. Treat unknown Base64 as untrusted input, especially when it decodes into a script or a command.
Pick the right escape for the context
HTML escaping, URL encoding and JSON string escaping are different operations with different rules. Escaping for HTML and then inserting into a JavaScript string leaves the value unsafe. Decide where the value is going, apply the escape for that context, and avoid decoding untrusted input before display.
Frequently asked questions
Why does btoa fail on Chinese text?
`btoa` works on Latin-1 code units. Encode the string to UTF-8 bytes first, then Base64 those bytes.
Is URL-safe Base64 the same as standard?
Same algorithm, different alphabet. A strict decoder for one variant may reject the other.
Should I use a data URI for images?
Only for small assets. Base64 adds about a third to the size and prevents separate caching; large images should stay as files.