How to use the Base64 Encoder/Decoder
- Choose Encode or Decode.
- Paste your text or Base64 string.
- The result appears instantly.
- Copy the output.
Example
| Input | Hello, world! |
|---|---|
| Result | SGVsbG8sIHdvcmxkIQ== |
What Base64 is for
Base64 turns any data into plain text made of letters, digits, “+”, “/” and “=”. It exists so that binary data, or text with unusual characters, can travel through systems that only handle simple text, such as email, JSON, HTML and URLs. The cost is size: Base64 output is about one third longer than the original.
Encoding and decoding
- Choose Encode or Decode, then type or paste your input. The result updates as you type.
- Text is converted as UTF-8, so emoji, accents and non-Latin scripts survive the round trip.
- URL-safe: replaces “+” and “/” with “-” and “_” and drops the “=” padding. This is the variant used in JWT tokens and URLs.
- Decoding accepts line breaks and spaces inside the Base64, and it also accepts both the standard and URL-safe alphabets.
- If you paste a data URI that begins with “data:”, the tool strips the prefix. For an image data URI it shows a preview.
- Encode any file → Base64 turns a file you pick into Base64, which is handy for small images and fonts.
Not encryption
Base64 is an encoding, not a way to protect information. Anyone can decode it in seconds, so never use it to hide passwords, tokens or personal data. If you need secrecy, use real encryption.
Troubleshooting
- “Not valid Base64”: the input contains characters outside the Base64 alphabet. Check for stray quotes, commas or truncated text.
- Garbled output after decoding: the data may not be text. When the decoded bytes are not valid UTF-8, the tool says so and shows the raw bytes instead.
- Missing “=” signs: padding is added automatically when decoding, so trimmed Base64 still works.
Related tools
Percent-encoding for web addresses lives in the URL Encoder/Decoder, and escaping characters for web pages is covered by the HTML Encoder/Decoder. To convert text to binary or hexadecimal digits instead, try the Text to Binary Converter.
Frequently asked questions
Can I convert an image or file to Base64?
Yes. Click “Encode any file → Base64” to turn any file up to 10 MB into a data URI. Paste an image data URI in Decode mode to preview it.
Is Base64 encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to protect passwords or secrets.
What is URL-safe Base64?
URL-safe Base64 replaces “+” with “-” and “/” with “_” and usually drops “=” padding, so the string can be used in URLs and filenames.
Why does Base64 end with equals signs?
Base64 works in groups of three bytes. When the data does not fill the last group, one or two “=” characters pad it out. The URL-safe option leaves them off.
Can I use it to embed an image in HTML or CSS?
Yes. Encode the image file, then use it in a data URI such as data:image/png;base64,... Keep it for small images, because the Base64 version is about a third bigger than the file.