A shim is code that adds a layer to make existing APIs work in different environments, while a polyfill specifically implements modern browser features in older browsers that don’t support them. In short: all polyfills are shims, but not all shims are polyfills.