File Size

A key factor for the load time of a web page is the file size of the HTML file and the images and scripts contained therein. File sizes should be kept as small as possible, especially for mobile web pages. The size of a digital file is specified in kilobytes, megabytes, or gigabytes. It is often recommended that the sum of the files should not exceed a 100 KB limit, but that is almost impossible for modern websites.

Factors affecting the file size

Depending on the file, its size depends on various factors.

  • Images: For images, both the resolution in pixels as well as the dimensions of graphics and color depth play an important role for the file size. The more pixels and color depth the image has, the more bytes the file needs.
  • HTML code: For source code files, the size depends partly on how many images have been added and on the other hand, how many characters have been included in the code, for example, attributes or comments. The more characters are used, the larger the file.
  • CSS or JavaScript: The more code the CSS file or JavaScript contains, the larger the file size.
  • Videos: For moving images, the file size depends on the size of each individual image and its repetition rate.
  • Audio files: As a general rule, the file size increases with the sound quality.

Reducing the file size

File size can only be reduced by a proper, server-side compression of all files. This mainly affects HTML and script files. In JPG format, images are already compressed (lossy). You need to adjust the picture format to the layout and not scale it in the browser with the attributes “width” and “height.” Moreover, it is usually sufficient when images are output with 80 percent quality and 72 dpi, since browsers do not display better quality anyway.

Media that is inserted into websites, should generally get compressed beforehand to keep the load time as short as possible. This is especially true for images and videos. In some cases, it is advisable to work with iframes, so that the file does not have to be loaded from your server. Websites with a lot of images or videos can also use a Content Delivery Network so as not to affect the load time.

Relevance to search engine optimization

File size is an important component of on-page optimization since it is closely associated with the load time of a website. Load time is an important ranking factor. The compression of image files therefore is a task that should be on the SEO to-do list. With optimization tools such as Google’s Page Speed, SEOs can get information on potential for optimization in terms of file size and other metrics.

In a broader sense, file size is also a factor for images SEO, because special file formats and specific sizes of images are preferred by the Googlebot. Moreover, file size affects ranking as part of Google’s and other search engines image search.

In mobile optimization, the file size should also be taken into account, since large files require too much memory resources on mobile devices even in the LTE era.

Server costs may vary depending on the file sizes used. If a website gets a lot of traffic and works with numerous images, minimal savings on file sizes can constitute considerable savings in required data volume and consequently also affect the cost of web hosting.

Web Links


Related Articles