concept

Data URI

Data URI is a URI scheme that allows embedding small data items directly into web documents, such as HTML, CSS, or JavaScript, as base64-encoded strings. It eliminates the need for separate HTTP requests by including the data inline, which can improve performance for small resources like images, fonts, or scripts. The format follows the pattern 'data:[media type][;base64],<data>' and is supported by all modern web browsers.

Also known as: Data URL, Data URI Scheme, data: URI, Inline Data, Base64 Data URI
🧊Why learn Data URI?

Developers should use Data URIs when embedding small, static resources (typically under 10KB) to reduce HTTP requests and latency, which is beneficial for performance-critical applications like single-page apps or mobile sites. It's particularly useful for icons, small images, or CSS background images in web development, but should be avoided for larger files due to increased document size and caching limitations. This technique is also handy in email templates or offline web apps where external resources might not be available.

Compare Data URI

Learning Resources

Related Tools

Alternatives to Data URI