Tools

Base64 Encoder

This tool encodes a file to Base64, which can e.g. be used to embed images in HTML, CSS or XML to reduce HTTP requests. Base64 encoding is designed to transport data through transport layers that are not 8-bit clean, such as mail bodies and the 7-bit SMTP protocol. Every 6-bit block is mapped to the characters [a-zA-Z0-9+/]1 and a sequence ends with =, as defined in RFC3548. Base64-encoded data takes about 33% more space than the original data.



 

Embedding Base64 content

You can embed the Base64 output into various documents using the following code:

HTML embedded PNG image
<img alt="Base64 Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />
HTML embedded CSS
<link rel="stylesheet" type="text/css" href="data:text/css;base64,LyogKioqKiogVGVtcGxhdGUgKioq..." />
HTML embedded JavaScript
<script type="text/javascript" src="data:text/javascript;base64,dmFyIHNjT2JqMSA9IG5ldyBzY3Jv..."></script>
CSS embedded PNG image
.image { width:100px; height:100px; background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...); }
XML embedded PNG image
<image> <title>Some Image</title> <link>http://www.host.domain</link> <url>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...</url> </image>
  1. Character sequence is in regular expression notation.