What is Base64?
Base64 turns any data (text, images, binary files) into a string made only of letters, digits and +, / and =, so it can travel safely through places that only accept text. Common uses include email attachments, data: images in web pages, HTTP Basic authentication headers and JWTs. The encoded result is about 4/3 the size of the original.
How to use
- Click "Encode" or "Decode" to choose the direction; the selected button stays highlighted.
- Type in the Input box. With "Auto convert" on, the result appears as soon as you stop typing.
- "Use result as input" moves the result to the left and flips the direction, which makes it easy to check a round trip.
Plain data format: text or Hex
- Text (UTF-8): normal text, including Chinese characters and emoji.
- Hex: raw bytes written in hexadecimal, such as
ff fe 00. Choose Hex when the decoded data is not text (an image or encrypted bytes, for example).
Standard vs URL-safe Base64
| Standard Base64 | URL-safe Base64 | |
|---|---|---|
| Characters 62 and 63 | + and / | - and _ |
| Padding | Padded with = to a multiple of 4 | Usually no = |
| Typical use | Email, data URLs, general data exchange | URL parameters, file names, JWTs |
Decoding accepts both variants and works even when = padding is missing, so you never need to switch modes to decode.
Examples
- The text
Hello 世界encodes toSGVsbG8g5LiW55WM - The Hex bytes
ff fe 00encode to//4A, or__4Ain URL-safe mode
Files and Base64
- File to Base64: drag an image, PDF or any file onto the input area, or click "Choose file" (up to 10 MB). "Add data URI prefix" produces
data:image/png;base64,..., ready for an HTML<img src>or CSS. - Base64 to file: when the decoded data is an image or other binary data, click "Download decoded file". The file type comes from the
data:prefix, or is detected from the first bytes (PNG, JPEG, GIF, WebP, PDF, ZIP and more). - Files are read in your browser only and never uploaded.
FAQ
Is Base64 encryption?
No. Base64 is only a different representation, and anyone can decode it. Do not use it to protect passwords or secrets. Use real encryption to keep data private, or an HMAC to check that data has not been tampered with.
Decoding says the data is "binary, not UTF-8 text"
The decoded bytes are not text; they may be an image, an archive or encrypted data. Switch "Plain data format" to Hex to see the raw bytes.
Why does the result end with one or two =?
Base64 encodes every 3 bytes as 4 characters. When the input length is not a multiple of 3, = pads the result to a multiple of 4.