A shim is a thin and often tapered or wedged piece of material, used to fill small gaps or spaces between objects. Shims are typically used in order to support, adjust for better fit, or provide a level surface. Shims may also be used as spacers to fill gaps between parts subject to wear.
Many materials make suitable shim stock (also often styled shimstock), or base material, depending on the context: wood, stone, plastic, metal, or even paper (e.g., when used under a table leg to level the table surface). High quality shim stock can be bought commercially, for example as laminated shims, but shims are often created ad hoc from whatever material is immediately available.
Laminated shim stock is stacked foil that can be peeled off one layer at a time to adjust the thickness of the shim.
In automobiles, shims are commonly used to adjust the clearance or space between two parts. For example, shims are inserted into or under bucket tappets to control valve clearances. Clearance is adjusted by changing the thickness of the shim.
In carpentry, small pieces of wood may be used to align gaps between larger timbers. In luthiery, shims made of various materials are often used to adjust neck alignment and can be used beneath a nut or saddle to raise the height of either.
In masonry, small stones may be used to align or fill gaps between larger bricks or slabs.
In nuclear magnetic resonance spectroscopy, "shimming an NMR magnet" is a procedure to generate homogeneous magnetic field along the sample volume to obtain pure Lorentzian line shapes of various resonances in the spectrum. This is accomplished by manual shimming of individual shims, or automatic shimming procedure.