Base64 Encode
Encode text to Base64 format. Supports various character sets, URL-safe encoding, and MIME-compatible line chunking.
Base64 Encoding Explained
Why do I need Base64 encoding?
Base64 is an encoding scheme used to represent binary data in an ASCII format. This is useful when binary data needs to be sent over media designed to handle textual data. Concrete examples include sending images in an XML file or in an email attachment.
How does Base64 encoding work?
Bytes forming the data are broken into buffers of 24 bits (3 bytes at a time). The resulting buffer is then broken into 4 packs of 6 bits each. Those 6 bits form a number corresponding to the index in the Base64 character set (A–Z, a–z, 0–9, + and /). If the number of bytes is not a multiple of three, padding is added: == for 1 remaining byte and = for 2 remaining bytes.
How can I embed a Base64 encoded resource in HTML, XML, and CSS?
Listed below are examples of how to embed Base64 resources within different web documents.
HTML image embedding:<img src="data:image/jpeg;base64,/9j/4AAQ..." />
XML image embedding:<image>data:image/jpeg;base64,/9j/4AAQ...</image>
CSS image embedding:.cls { background-image: url('data:image/jpeg;base64,/9j/4AAQ...'); }