Data URIs are a method of embedding resources directly into a document instead of loading them as separate files. Imagine, for example, that you have inserted a small image (icon) or other files directly into your HTML or CSS code, which the browser can display without having to make an extra request to the server.
They are particularly suitable for small files where communication itself would cause and make up a relevant part of the data transfer by speeding up the display and thus improving the user experience.
However, since it is longer than the pure data itself, you are not without disadvantage.
The tool allows you to convert a file into a data URI and also informs you about the effect on the size. This allows you to find the best compromise.
It is easy to use. Upload the file you want to convert.
The MIME type reported by your browser will be used.
You will then see the data URI, which you can copy and use directly.
You can also see the size of your file, the size of the data URI and the remaining size after Gzip compression.
Good luck with speeding up your website and improving the user experience.
Please upload the file to convert.
A data URI (Uniform Resource Identifier) is a scheme that makes it possible to embed data inline in websites or other documents. Instead of referring to an external file, the URI itself contains the data.
The basic syntax of a Data URI is as follows:
data:[<mediatype>][;base64],<data>
With the meanings:
Example of a small red PNG image as a data URI:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red Dot">
In this example the browser does not need to separately request red-dot.png. The image data is contained directly in the src-attribute of the <img>-tag. The browser decodes the base64-string and renders the image as image/png.
In the same way, any type of file can be included directly.
The biggest advantage is the reduction in HTTP requests. Each external file (image, font, etc.) normally requires a separate request to the server. With many small files, this can significantly slow down the loading time of a page. Embedding the resources eliminates these requests.
Especially for very small files, direct embedding can be faster than accepting the overhead of an HTTP request (handshake, headers, transferred cookies, etc.).
The document becomes more independent, as all the required (small) resources are included directly. This can be useful if web pages are to be used without a network connection, saved as a single HTML file or sent by e-mail.
External CSS or JavaScript files can block the rendering of a page until they are loaded. Inline data (although often handled differently with JS and CSS) is immediately available as it has already been downloaded with (=in) the HTML file.
As already mentioned, Base64 encoding increases the amount of data by around 33% compared to the original binary file. If you embed many or large files, the HTML or CSS file itself can become very large.
This disadvantage can often be mitigated by server-side Gzip compression, which generally leads to an acceleration and is de facto standard. Here, it is not the file as such that is downloaded, but:
Despite the effort involved in compressing and decompressing the data, this is generally faster than transmitting it uncompressed. As Base64-encoded data often contains repetitive character strings, it can be compressed particularly well.The tool shows you the original size, the size of the data URI and the effective size of the compressed data URI. This gives you a better overview to evaluate the impact.
A resource embedded as a data URI is "reloaded" each time the page is called up, as it is part of the main document. External files, on the other hand, can be cached by the browser. If the same image is used on many different pages of your website, it would have to be transferred with the page each time if data URIs are used. This also means that an icon used several times on the same page would be included several times.
You can easily avoid this by using the data URI in an external CSS file, for example. This CSS file is then cached by the browser. So if you use the same icon (as a data URI) on several pages or the same page, but always via the same (cached) CSS file, the data URI is not reloaded each time, but is provided with the CSS file from the cache.
Long Base64 strings naturally make the HTML or CSS code unclear and more difficult to maintain. Updating an embedded resource is more cumbersome than replacing an external file.
Browsers often have an upper limit for the length of URIs. Very large files can therefore not be embedded as data URIs. However, this is hardly a limitation due to the already mentioned increase in length.
In some contexts (e.g. emails), data URIs can be misused for phishing or the infiltration of malicious content, which is why some email clients or security software block them.
The tool shows you the original size, the size of the data URI and the size of the compressed data URI, so that you can make an informed decision about where it makes sense to use it. These are for example:
Small icons, logos or background patterns that are only a few bytes to kilobytes in size are ideal candidates. Here, the advantage of the saved HTTP request often outweighs the disadvantage of the somewhat larger file size (especially after compression).
For elements that need to be immediately visible (above-the-fold content), embedding small background images can improve the perceived loading time.
A special case here is the immediate display of an image with a lower resolution, which is then replaced if an image with a higher resolution has been loaded separately. This gives your visitor immediate feedback and a high-resolution image later.
Data URIs are practical if a website is to be passed on as a single file or used offline.
Small font subsets can be embedded in CSS as data URIs to reduce flickering of text (FOUT/FOIT). The size deviation is particularly important here.
The disadvantages described above mean that data URIs should sometimes not be used, at least not directly:
Embedding photos or other large resources leads to bloated HTML/CSS files and should be avoided. External linking with browser caching is the better choice here.
The tool shows you the original size, the size of the data URI and the effective size of the compressed data URI. This gives you a better overview to evaluate the impact.
If you embed an image on 100 pages and it is in the HTML code as a data URI each time, it will be transferred 100 times. An external, cached file would be much more efficient here.
If the data URI is embedded in a separate CSS file that is used by all 100 pages, the CSS file is cached and the disadvantage of the lack of individual caching of the resource is eliminated.
Data URIs reduce the number of requests and thus speed up rendering, especially when used with small files such as icons. They can be used for all files, but also have an effect on the file length of the embedding file, which can sometimes be mitigated by caching and compressed transmission.
The tool takes care of the conversion and provides you with the relevant information.
Copyright © 2014–2025 by generiere.de . All rights reserved. Hosted by all-inkl.
Contact · Imprint · Privacy
Page generated in 9.75ms.
www.traktor-forum.com | daelim-forum.myspreadshop.de | www.daelim-forum.com