How to use Base64 Encoder
- 1. Paste text or open a file. Use Text for strings, File for images/PDFs. UTF-8 emoji is supported.
- 2. Copy Base64 or a Data URI. Switch presets for HTML, CSS, JSX, or JSON wrappers.
- 3. Optional URL-safe mode. Toggle URL-safe for JWTs and query strings.
About this tool
“Base 64 encoder” and “base64 encoder” are the same job: turn bytes into ASCII. People also search encoder + decoder together; use the Encode/Decode toggle or the decoder page when you need the reverse.
Encoder vs encryption
Base64 is encoding, not encryption. Anyone can decode the output. Never use it as a way to hide secrets.
Image and file encoding
Drop a PNG, JPG, or PDF in File mode to get a Data URI (`data:image/png;base64,…`) ready for HTML and CSS prototypes.
Code examples
Node
Buffer.from("hello").toString("base64");
Buffer.from(b64, "base64").toString("utf8");Browser (UTF-8 safe)
btoa(unescape(encodeURIComponent(text)));
decodeURIComponent(escape(atob(b64)));Python
import base64
base64.b64encode(b"hello").decode() # aGVsbG8=
base64.b64decode("aGVsbG8=").decode()Data URI
const uri = `data:image/png;base64,${b64}`;
// <img src={uri} /> or CSS url('${uri}')