Until recently, most people recommended a shotgun for an ideal home defense weapon. It's powerful, more so than any pistol. There is that whole "the sound of racking the slide makes burglars lose bowel control" myth. Plus the "you don't ahve to aim it" myth. The bird shot loads won't over penetrate through dry wall and injure other folks in the house or neighborhood. Myths that can cause problems.
Lately people have been rethinking that advice and suggesting an AR would be better. The .223 supposedly dump energy fast enough that over penetration is less of an issue that people think for a rifle round. It holds 30 rounds instead 5, 7, or maybe 9. It's often more compact and lighter to manuever around. Easier to attach a sling and flashlight to. Yeah, for me, I like defending the house with an AR better than a shotty.
But if you can overcome the myths of a shotgun there is one advantage I (stupidly) hadn't considered... Cost. An AR, cheap, will run, what? $700 for a bare bones one? More? (when the market isn't screwy like it is now...) A typical shotty for home defense is south of $300. Even today, during the gun buying frenzy. As Joe Biden says, that price delta can be, "a BIG friggin' deal..."
If you HAVE an AR, or can afford one, or want one more than a shotty and have a line on one, I'd say use the AR. You don't HAVE to run out and get a shotgun if you don't want one. If you have nothing, now, or don't have deep pockets, getting a shotgun today to defend your house is better than waiting a while to get an AR. And if you just moved out of your parents house or graduated college and took a job away from your hometown or what have you and can't find and AR now for love or money.
Please don't use bird shot for a defense load, and have a backup plan if the sound of racking the pump doesn't scare off badguys.
[addendum: 'But T-bolt, you don't use your AR or shotty for primary home defense! You use .357 revolvers' True. I still haven't prepped the place to keep a longer gun secure yet accessible for bumps in the night situations. My choice, when I do, is an AR or a 18 inch 12 gauge. I will go with the AR, then. But there is something to be said for ease of use when you wake at 3AM to kicks at the door and the revolver can excel here.]
I’ll just leave this here -
1 hour ago