One of the factors we learned about increasing the stability of resonance structures was the presence of heteroatoms next to carbocations due to the donation of the lone pair and forming a new resonance structure with a complete octet on all atoms:

Even if we ignore the octet for a moment, in the bigger picture, carbocations have a positively charged carbon atom, and any factor that can compensate for this electron deficiency will stabilize the carbocation.
For example, the more alkyl groups are connected to the carbocation, the more stable it is because the electron-withdrawing nature of the carbocation pulls some electron density through the sigma bonds. This is known as the inductive effect, where electron density is donated through σ bonds toward the electron-deficient carbon.
Because of this, the more substituted carbocations are more stable, following the order tertiary > secondary > primary > methyl:

For a broader spectrum of carbocation stability, we also include allylic and benzylic carbocations, which are generally more stable due to resonance stabilization. In these cases, the empty p orbital of the carbocation can overlap with an adjacent π system, allowing the positive charge to be delocalized over multiple atoms:

Hyperconjugation
Another effect that stabilizes carbocations is hyperconjugation. In this case, the σ bond of an adjacent C-H (or C-C) bond overlaps with the empty p orbital of the carbocation. As a result, some electron density from the σ bond is delocalized into the empty p orbital, reducing the electron deficiency of the positively charged carbon:

Unlike resonance, no bonds are broken or formed, but the positive charge is spread over a larger region, making the carbocation more stable.
Since tertiary carbocations have more adjacent alkyl groups and therefore more neighboring σ bonds that can participate in hyperconjugation, they are stabilized to a greater extent than secondary or primary carbocations.
Hyperconjugation in Radicals
Hyperconjugation is also relevant to the stability of radicals. Like carbocations, radicals are electron-deficient species and are sp2-hybridized. The main difference is that a carbocation has an empty p orbital, whereas a radical has a p orbital containing one unpaired electron:

Just as with carbocations, the stability of radicals increases with the number of alkyl groups attached to the radical center, following the order tertiary > secondary > primary > methyl:

This is because alkyl groups donate electron density through both the inductive effect and hyperconjugation. The adjacent σ bonds overlap with the half-filled p orbital of the radical, allowing the unpaired electron to be delocalized over a larger region. As a result, the electron deficiency at the radical center is reduced, making the radical more stable:

Another important factor that stabilizes radicals is resonance. When the radical is adjacent to a π bond, the unpaired electron can be delocalized over the conjugated system by resonance:

Consequently, allylic and benzylic radicals are among the most stable carbon radicals because the unpaired electron is spread over multiple atoms rather than being localized on a single carbon. This resonance stabilization is analogous to the stabilization of allylic and benzylic carbocations.
Check Also
- Introduction to Alkyl Halides
- Nomenclature of Alkyl Halides
- Substitution and Elimination Reactions
- Nucleophilic Substitution Reactions – An Introduction
- All You Need to Know About the SN2 Reaction Mechanism
The SN2 Mechanism: Kinetics, Thermodynamics, Curved Arrows, and Stereochemistry with Practice Problems - The Stereochemistry of SN2 Reactions
- Stability of Carbocations
- The SN1 Nucleophilic Substitution Reaction
- Reactions of Alkyl Halides with Water
- The Stereochemistry of the SN1 Reaction Mechanism
- The SN1 Mechanism: Kinetics, Thermodynamics, Curved Arrows, and Stereochemistry with Practice Problems
- Steric Hindrance in SN2 and SN1 Reactions
- Carbocation Rearrangements in SN1 Reactions with Practice Problems
- Ring Expansion Rearrangements
- Ring Contraction Rearrangements
- When Is the Mechanism SN1 or SN2?
- Reactions of Alcohols with HCl, HBr, and HI Acids
- SOCl2 and PBr3 for Conversion of Alcohols to Alkyl Halides
- Alcohols in SN1 and SN2 Reactions
- How to Choose Molecules for Doing SN2 and SN1 Synthesis-Practice Problems
- Exceptions in SN2 and SN1 Reactions
- Nucleophilic Substitution and Elimination Practice Quiz
- Reactions Map of Alkyl Halides