Check image dimensions and convert to Base64
The Image Info / Base64 tool does two things. It reads the file name, size, type and pixel dimensions of an image you choose, and it converts the image into a Base64-encoded data URL that you can embed directly in a web page, a stylesheet or a JSON file instead of keeping a separate image file. It does not compress, crop or modify the image, and it does not read EXIF metadata such as shooting time or camera model. Base64 is only a text representation, and it makes the data larger, so it suits very small icons rather than large pictures.
We built a real 1×1 pixel red PNG, which is 69 bytes. Uploading it shows Size as '0.1 KB' (69 divided by 1024, to one decimal place), Type as image/png, Dimensions as 1 × 1, and a data URL of data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC, which is 114 characters long. The size rule: Base64 encodes every 3 bytes as 4 characters, so the text is about four thirds the size of the file, plus a prefix of 22 characters for data:image/png;base64,. For a 30,000-byte file (shown as 29.3 KB), the Base64 part is 40,000 characters and the whole data URL is 40,022 characters. These figures were calculated, not estimated.
For very small images: icons inside CSS, a logo in an email template, or cases where everything must live in a single HTML or JSON file with no extra request. The data grows by about a third and can't be cached separately by the browser, so for large images Base64 usually costs more than it saves.
'Raw encoding' copies the complete data URL, which can go straight into an <img> src attribute or a CSS url(). 'CSS background' wraps it in background-image: url(…); so it can be pasted directly into a stylesheet. If special characters or parentheses in your data URL confuse your CSS, wrap the url() content in quotes by hand.
The tool reports the pixel size after the browser has decoded the image. Most browsers apply the rotation stored in a photo, so a portrait photo from a phone can have its width and height swapped compared with the raw sensor size that some software displays.
This tool doesn't do that. A data URL can, however, be pasted into the browser's address bar or used as an image src, and the browser will display it as a picture.
The image is read and converted locally by your browser. The code makes no network requests, so the picture is not uploaded to a server and not stored. The preview and the encoded text disappear when you close or reload the page.