Image Preparation

Create an Image Data URI From a Fresh PNG

Updated

A data URI embeds image bytes inside text. It can be convenient for a small controlled asset, but it is not automatically a better way to deliver every website image.

Image to Base64 creates a PNG from the decoded pixels and returns its Base64 data URI as a text file. It does not encode the original upload bytes unchanged.

Expect a PNG prefix

The result begins with data:image/png;base64, followed by the encoded bytes. The PNG retains the decoded source dimensions and appropriate alpha, within the image tool limits.

A source JPEG therefore becomes a new PNG before encoding. Any original metadata, comments or colour profiles are not carried into that generated file.

Base64 usually uses more characters than the binary bytes it represents. Embedding a large data URI into a document can therefore make that document heavy, even though no separate image URL is needed.

Use it where embedded data is accepted

A field that expects an ordinary web address may not accept a data URI. Content security policies or application restrictions can also reject embedded image data. Check the receiving system rather than assuming a valid string works everywhere.

The tool does not upload the image to a public URL or add it to the WordPress Media Library. The downloadable text is the prepared representation itself.

Encoding is not encryption. Anyone with the complete data URI can attempt to decode and view the image. Avoid treating it as a way to hide private documents.

For a normal article photo, a properly served image file is often easier to manage. Use a data URI for a specific supported embedding task, and keep the original alongside the generated PNG representation for later revisions.

Join the conversation

Your email address will not be published. Required fields are marked *

Explore Whatson tool information