What Is a Shim? Meaning, Materials, and Uses

A shim is a thin piece of material used to fill a small gap between two objects. Its job is simple: support, level, or adjust the fit between parts that don’t quite align on their own. Shims show up everywhere, from a cedar wedge tapped behind a door frame to a precision-ground metal disc inside a car engine. The concept is the same regardless of scale or material: you’re adding a carefully sized filler to close a gap or correct an alignment.

How Shims Work

Most shims are tapered or wedge-shaped, which lets you slide them into a gap and control exactly how much fill you add. Push a tapered shim deeper and the gap gets tighter; pull it back and the gap opens up. Flat shims, by contrast, come in precise thicknesses and stack together to reach a target measurement. Industrial shim stock ranges from as thin as 0.002 inches (0.05 mm) up to 0.075 inches (2 mm), and you can layer multiple pieces to hit virtually any thickness you need.

This stacking ability is what makes shims so useful for fine adjustment. Rather than machining a custom part to fill a 0.037-inch gap, you can combine a 0.025-inch shim with a 0.010-inch shim and a 0.002-inch shim. Laminated shims take this even further: they’re made of bonded layers you can peel apart one at a time until you reach the exact thickness required.

Shims vs. Spacers

People often use “shim” and “spacer” interchangeably, but they serve different purposes. A shim is about correction: fine-tuning alignment, leveling a surface, or compensating for wear. A spacer is about separation: maintaining a fixed, intentional distance between two components. In practice, a spacer is designed into an assembly from the start, while a shim is added to fix an imperfect fit or compensate for real-world variation.

Common Materials

The material depends entirely on what the shim needs to withstand. In construction and carpentry, small pieces of wood (often cedar or pine) are the classic choice for aligning gaps between larger timbers. Plastic shims made from polypropylene are popular for leveling window frames, door frames, floor joists, and ceiling battens because they resist moisture and won’t rot over time.

Metal shims step in when loads are heavier or conditions are harsher. Galvanized steel shims, for example, are used in telecommunications tower modifications where flat plates need leveling under structural loads that would crush plastic. Brass, stainless steel, and aluminum shim stock are common in precision machinery. In masonry, small stones have served as shims for centuries, filling gaps between larger bricks or slabs.

Shims in Construction

If you’ve ever hung a door or installed a window, you’ve probably used shims. The rough opening in a wall is deliberately oversized, and shims get tapped into the gaps between the frame and the framing lumber to make everything plumb, level, and square. You slide a tapered shim in from each side so the two wedges meet and create a flat, adjustable pad. Once the frame is positioned correctly, you fasten through the shims and snap off any excess that sticks out.

For larger-scale leveling, like correcting an uneven floor over a long span, carpenters sometimes cut custom tapered shims from dimensional lumber. A common technique involves cutting two six-foot shims that taper from roughly 15/32 of an inch down to nothing, then butting them together to create a gradual correction over 12 feet. This kind of work is about removing variation so that the finished surface (a subfloor, a countertop, a cabinet run) reads as perfectly flat.

Shims in Automotive Engines

Inside many car engines, tiny metal shims control the clearance between camshafts and valves. This gap matters because metal expands as it heats up, and valves need just enough room to close fully when the engine reaches operating temperature. Too little clearance and the valve can’t seal properly. Too much and the engine gets noisy and loses efficiency.

Adjusting these shims is a precise, labor-intensive process. With the engine completely cold, a mechanic measures each valve’s clearance using feeler gauges, then removes the camshafts and pulls out each shim to measure it with a micrometer. The formula for calculating a replacement shim is straightforward: take the measured clearance, subtract the target clearance, and add the thickness of the existing shim. If your measured clearance is 0.007 inches, your target is 0.010, and the current shim is 0.110, you need a 0.107-inch shim.

Valves tend to lose clearance over time because the repeated pounding of valve heads against their seats gradually pulls them deeper into the cylinder head, raising the valve stem tips. The shim itself also develops a small dent where the valve stem strikes it, which is why mechanics use a micrometer rather than calipers to measure the worn area directly.

Shims in Software

The concept of filling a gap translates neatly into computer programming. A software shim is a small piece of code that sits between a program and the system it’s running on, intercepting requests and translating them so everything works together. It fills a compatibility gap rather than a physical one.

One of the most common examples is backward compatibility. When an operating system updates and changes how its features work under the hood, older programs that relied on the previous behavior can break. Microsoft’s Windows Application Compatibility Toolkit uses shims to simulate older versions of Windows so that legacy software keeps running without modification. The program thinks it’s talking to an old system, but the shim quietly translates those requests into something the new system understands.

The same idea works in reverse. Web developers use “polyfills,” which are shims that bring newer web standards to older browsers. If a browser doesn’t support a modern feature, the polyfill recreates that feature using older code the browser does understand. Apple used a similar approach during its transition between networking systems on early Macintosh computers, rebuilding the older AppleTalk protocol as a shim layer on top of the newer Open Transport system so thousands of existing programs continued to work.

Shims in MRI Machines

Even medical imaging relies on shimming. An MRI scanner needs an extremely uniform magnetic field to produce clear images, and the term “shimming” actually originates from the physical practice: early MRI engineers placed small pieces of iron and steel at strategic positions inside the scanner to smooth out irregularities in the magnetic field, just like a carpenter shimming a door frame.

Modern MRI machines use two approaches. Passive shimming still involves placing magnetically responsive materials inside the scanner bore to nudge the field toward uniformity. Active shimming uses electrical coils that generate corrective magnetic fields, with each coil shaped to address a specific type of field distortion. Both methods serve the same purpose as any other shim: correcting small imperfections so the final result is precise and reliable.