Base64 Encoder and Decoder
Encode and decode Base64 text or images, including files to Base64
文本编解码
图片转Base64
输出结果
About this tool
Base64 represents binary data with 64 printable characters (A-Z, a-z, 0-9, + and /), which is why it appears in email transport, inline web images, API payloads and JWT tokens.
- Text encoding: turn any string, Chinese included, into Base64
- Text decoding: restore Base64 to readable text with automatic UTF-8 detection
- Image to Base64: upload an image and get a
data:image/...;base64,...Data URI ready for CSS or HTML - Base64 to image: rebuild and preview an image from a Base64 string
When to use it
- Inline small images in HTML or CSS to cut HTTP requests
- Embed images in email bodies
- Move binary data through an API
- Encode the header and payload of a JWT
All encoding and decoding runs in the browser; nothing is uploaded.
Base64 notes
- How it works: every 3 bytes (24 bits) become four 6-bit groups mapped to 64 printable characters
- Size change: encoded data grows by about one third, 3 bytes to 4 characters
- Padding: when the input is not a multiple of 3 bytes, = fills the gap, so strings often end in = or ==
- Data URI: the
data:image/png;base64,...form embeds directly in HTML or CSS