Base64 Encode
Encode text or files to Base64 in your browser. URL-safe variant, data URI generator, image preview for encoded images. Nothing is uploaded or stored.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is used wherever binary data must survive transport through systems designed to handle only text — for example, embedding images in HTML or CSS, encoding email attachments (MIME), and passing binary values in JSON APIs.
Standard vs URL-safe Base64
Standard Base64 uses + and /, which are reserved characters in URLs and may cause issues when embedded in query strings or filenames. URL-safe Base64 (RFC 4648 §5) replaces them with - and_ and omits padding, making the output safe to include in URLs without percent-encoding.
How to encode a file to Base64
- Switch to the File tab.
- Drag and drop any file onto the dropzone or click to browse.
- Toggle Include data URI prefix to generate a complete
data:mime;base64,…string usable directly in HTML. - Copy the output or download it as a
.b64.txtfile.
Frequently Asked Questions
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters. It is commonly used to embed binary data in JSON, HTML, and CSS.
What is the difference between standard and URL-safe Base64?
URL-safe Base64 replaces + with - and / with _ so the encoded string can be used in URLs and filenames without percent-encoding.
Can I encode an image to a data URI?
Yes. Drag and drop an image file, and the tool generates a complete data:image/... URI you can use directly in HTML or CSS.