Tempering is a heat treatment technique for metals and alloys, most often the toughening of martensitic steel. Most steel blades (from knives to swords) are hardened by quenching (which produces a martensitic transformation), but this hardening effect generally must be reduced by tempering to avoid brittleness.

Temperare (to mix correctly) is the Latin origin of words like "temperature" and "tempering"; it and "tempo" come, in turn, from tempus (time or season). Thus, the word "temper" can refer (at least informally) to any time- and temperature-sensitive process (as for chocolate tempering or tempered glass), a material's thermo-mechanical history (including cold work and cryogenic hardening), or even its composition.

The heat-treatment process of a stereotypical steel involves heating the object (usually in a forge) (austenizing) and then causing a quick and sharp drop in its temperature (quenching). Together, these two processes produce an extremely hard microstructure in medium-carbon or high-carbon steels, which can then be "tempered" (normalized, moderated) to prevent the material from shattering. Chemically, the process of tempering is a transformation from metastable martensite to ferrite and cementite.

A uniform alloy will always see a tradeoff between softness and brittleness. This delicate balance highlights many of the subtleties inherent to the tempering process: precise control of both time and temperature are critical to avoid the useless extremes of mechanical properties. Although the temperatures used in tempering are often too low to be gauged by the color of the workpiece, the lengths of time involved can still be measured using music. The cumulative effects of time and temperature can also be gauged by monitoring the color of the oxide film formed by tempering a well-polished blade.

The exquisite properties of ancient Japanese swords are in great part owed to the blacksmiths' traditional understanding and control of these parameters. However, they also reflect a means of transcending the brittleness tradeoff, by creating a blade of nonuniform composition. Great pains were taken to create a layered structure, so that some (high-carbon) areas are fully martensitic, while other (low carbon) areas are unresponsive to heat-treatment and so remained soft to provide toughness. Differential quenching was also used to reduce the need for tempering, which was only used to a very limited extent on such blades. This process involved holding a hot block of copper against different points along the blade's spine to locally adjust its curvature.

Taken to an extreme, similar strategies can allow extremely hard and tough blades to be made without any austenization, quenching, or tempering at all, as in materials such as Damascus steel.