Placeholder Image Generator

Enter the dimensions (max 2000x2000):

x
Placeholder Image

Using a data:image URL has advantages over using an external image:
  • Control: Full control over the image without relying on third-party services.
  • Performance: Embedding images directly reduces external requests, improving page load time.
  • Reliability: No risk of downtime or broken links from external providers.

  • Size limits: Browsers have limits on the size of data URLs they can handle.
  • Not cachable: Data URLs are not cached by browsers, potentially impacting performance on repeated visits.
  • Not ideal for large images: For very large images, external image files are generally more efficient.

  1. **Generate the image:** Use an image editor or a tool like this one to create your image.
  2. **Get the data URL:** The tool will provide you with a data:image URL representing your image.
  3. **Insert into `src` attribute:** Paste the data URL into the src attribute of an <img> tag in your HTML.

Example:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

While generally safe, be mindful of potential XSS vulnerabilities if you are dynamically generating data URLs with user-supplied content. Always sanitize user input to prevent malicious scripts from being injected.

Yes, you can use data URLs in CSS to embed images directly into stylesheets. This is common for small background images or icons.