DEV Community

Niels Swimburger.NET ๐Ÿ”
Niels Swimburger.NET ๐Ÿ”

Posted on • Originally published at swimburger.net on

Introducing online base64 image encoder

In addition to loading images on an HTML page by referencing the image via URL, you can also embed the base64 string of the image. In most cases, this is not a good idea because it will make your HTML page much larger in size and the image won't be cached by URL. Though, there are some edge cases where this is useful.

This little tool generates the base64 data URL for the file you select without uploading it to a server.

The base64 encoding happens inside your browser. You can find this little tool here: Online base64 image encoder

Screenshot of "Online base64 image encoder" tool

Alternatively, you can use the following PowerShell command on Windows: [convert]::ToBase64String((get-content "PATH_TO_IMAGE_HERE" -encoding byte)).

On Linux, you can use the following command base64 "PATH_TO_IMAGE_HERE".

Top comments (0)