What is msimgsiz.dat?

Inside your Temporary Internet Files folder you likely have a file named msimgsiz.dat. If you open this file, you’ll find that it contains nothing but binary goo:

EditPadPro Hex View of msimgsiz.dat

Over the years, many people have asked or speculated about what this file is used for, and the answer is actually quite simple.

This file, used by MSHTML, is simply a lightweight cache of image dimensions (width and height).

Why does Internet Explorer bother caching this data?

For performance reasons, the layout engine can often perform faster if it knows the width and height of a given image; many layout calculations depend on the sizes of embedded objects. An IMG tag that does not specify width and height attributes must be sized according to the intrinsic dimensions of the image file it displays. However, to determine these dimensions, the browser must actually load and parse the image, and doing that might even require a network request. Hence, determining the dimensions of an image may take a fair amount of time in this performance-critical codepath.

To mitigate that bottleneck, this memory-mapped file simply maintains a cache of image URLs to image dimensions for images that have been previously decoded by MSHTML. If the cached values are incorrect (e.g. because the image has been changed, or there was a hash collision) it’s not a problem; when the new/correct size is discovered, the image’s size is adjusted quickly and another layout occurs.