Base64 Encode
Encode text or files to Base64 instantly in your browser, including full support for non-English text and emoji. Build a Basic Auth header, create a data URI for a small SVG or icon, or construct the payload segment of a JWT by hand.
Usage examples
Building a Basic Auth header for an API request
Encode "username:password" as Base64 and drop it straight into an Authorization: Basic header.
Carrying small binary-ish data as plain text
Useful when you need to safely embed data containing special characters into a plain text field — a config file, a JSON value, and so on.
Encoding a value to use in a URL
If the result needs to go into a URL path or filename, turn on the URL-safe option so no + or / sneaks in.
Embedding a small SVG or icon as a data URI
Encode raw SVG or image text as Base64 and wrap it in data:image/svg+xml;base64,... to inline it directly in CSS or HTML without a separate file request.
Creating the payload segment of a JWT by hand
A JWT's header and payload are just JSON objects Base64url-encoded and joined with dots. Encoding {"alg":"HS256","typ":"JWT"} with the URL-safe option on shows exactly what goes into the token before signing.
Storing a binary-ish secret value in a .env file
Environment files only hold plain text lines. Encoding a key or token that contains newlines or quotes as Base64 keeps it on a single safe line in .env, to be decoded back at runtime.
Quick reference
| Text | Base64 | Base64URL |
|---|---|---|
| a | YQ== | YQ |
| ab | YWI= | YWI |
| abc | YWJj | YWJj |
| hello | aGVsbG8= | aGVsbG8 |
| Hello World | SGVsbG8gV29ybGQ= | SGVsbG8gV29ybGQ |
| Hello, World! | SGVsbG8sIFdvcmxkIQ== | SGVsbG8sIFdvcmxkIQ |
| test | dGVzdA== | dGVzdA |
| password | cGFzc3dvcmQ= | cGFzc3dvcmQ |
| 123456 | MTIzNDU2 | MTIzNDU2 |
| admin:admin | YWRtaW46YWRtaW4= | YWRtaW46YWRtaW4 |
| admin:password | YWRtaW46cGFzc3dvcmQ= | YWRtaW46cGFzc3dvcmQ |
| user:password | dXNlcjpwYXNzd29yZA== | dXNlcjpwYXNzd29yZA |
| {"alg":"HS256","typ":"JWT"} | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 |
| ??? | Pz8/ | Pz8_ |
| >>> | Pj4+ | Pj4- |
| é | w6k= | w6k |
| 한글 | 7ZWc6riA | 7ZWc6riA |
| 😀 | 8J+YgA== | 8J-YgA |
Frequently asked questions
Is the text I type sent to a server?
No. Encoding happens entirely in your browser, and what you type is never sent to a server.
Is Base64 a form of encryption?
No. Base64 is just a way to represent data safely as text — it isn't encryption. Anyone can easily decode it back to the original value, so don't use it to hide passwords or sensitive information.
Does this handle non-English text and emoji?
Yes. The input is converted to UTF-8 bytes before encoding, so non-English characters, emoji, and other Unicode text are all handled correctly.
When should I turn on the URL-safe option?
Turn it on when the result needs to go into a URL or a filename. It swaps the +, /, and = characters used in standard Base64 for -, _, which are safe in URLs, and drops the trailing = padding.
Why is the output longer than my input?
Base64 represents every 3 bytes of input as 4 output characters, so encoded text is roughly 33% larger than the original. This is expected overhead, not an error.
What are the = characters at the end for?
They're padding. Base64 processes input in groups of 3 bytes; when the input length isn't a multiple of 3, = characters pad the final group out to a full 4-character block. The URL-safe option in this tool omits padding entirely, which is valid as long as the decoder knows the original length or can infer it.
What's the actual difference between standard Base64 and Base64url?
They use the same scheme with two characters swapped: standard Base64 uses + and /, while Base64url (used in JWTs, URLs, and filenames) uses - and _ instead, since + and / have special meaning in URLs. Padding is also commonly dropped in Base64url, as this tool's URL-safe option does.