Rifles usually have a much greater ammunition capacity than shotguns. Even in “restricted” states that allow 10, 15, or 20 round capacity magazines maximum, that is usually more cartridges than a home-defense shotgun can hold, and a standard 30-round magazine holds up to 6 times more cartridges than a standard shotgun.
Furthermore, a semi-automatic “AR” rifle is much faster and easier to reload than a typical tube-fed home-defense shotgun. Even the relatively rare box-magazine-fed shotguns are usually a bit problematic to load and are generally not as reliable as variants with a typical tube magazine.
Although it’s unlikely that in a home-defense scenario a longer-distance shot will be required (or indeed justified), rifles are far more accurate over longer ranges than shotguns. In addition, since rifles only fire one projectile per shot, and very accurately, there may be less chance of a stray projectile that doesn’t impact the intended target, and which may be potentially dangerous to innocent people in your home or other homes nearby.
High-speed rifle cartridges are usually more capable of defeating soft body armor as well, in case your attacker is wearing it. Body armor that is rated for stopping handgun rounds often fails to stop 5.56/.223 rifle ammunition.
Another advantage of a rifle, particularly a semi-automatic rifle chambered in .223 Remington or 5.56 nato, is that recoil is negligible and is easily managed by younger or smaller-statured shooters. Shotguns can give quite a startling amount of recoil when loaded with effective defensive cartridges.
Advantages of shotguns for home defense
Though rifle bullets are very effective against human-sized targets, shotgun ammunition can be as well. The typical load of “double-aught” or 00 buckshot delivers 8 or 9 .33” lead balls to the target with each pull of the trigger. The amount of energy Buckshot is so named because it was designed for hunting larger game, such as deer (buck), but it is also devastatingly effective as a tactical or defensive cartridge.