First of all, let's be realistic- the chances of you encountering an armed home invader, depending on where you live, are probably lower than the chances of getting struck by a drunk or elderly driver, and possibly lower than getting struck by lightning. If you want to base things on pure practicality it's a better investment to be installing a roll cage in your car and buying a
HANS device and a
rubber suit rather than firearms. But unlike those things firearms have many other uses, and are enjoyable to use, so if you are going to own them you have no reason not to have one double as a home defense option.
The most common thing you hear when asking about a good home defense firearm is (in a Southern accent, regardless of where you are geographically) "pump shotgun," usually the cheaper Mossbergs or Remingtons. However, in this article I will show you with very simple to understand scientific facts why shotguns don't stand up to other choices. If I and many other people can do this, why do you still hear "pump shotgun" most of the time this question comes up? The reason is a positive feedback loop. At some point Jeb decided the pump shotgun is the best home defense firearm, discussed it with Cletus, Cletus agrees and tells Bubba, and this continues until this "knowledge" is so deeply ingrained in gun culture that people believe it to be fact, even when confronted with very clear, factual information showing otherwise. So in the effort to spread knowledge and liberate the thinking man from the chains of this absurd belief, let's divide it up one myth at a time:
Myth #1: Pump Shotguns are the Simplest to UseYes they are very simple mechanically, but this does not translate to simple to use. A pump shotgun has to be manually cycled for each shot. Yes this is easy on a flat range, but waking up at 3am, confronting an armed intruder, you are likely going to be under more stress than you have ever experienced, and will quickly find your motor skills out the window. Short stroking happens to even the most experienced shooters just on the range, the chances of it happening in a scenario like this are not only high, but potentially deadly for the user. Another issue is reloading. Shotguns are already limited capacity-wise, and rather than changing a magazine on a carbine or handgun, typically must be loaded one shell at a time, which is not only much slower, but also requires more training to do well. When you are in a panic state, no matter how much training you have, it's not going to be easy to remove shell by shell from a saddle or wherever else you store extra ammo and feed it one at a time into the tube. You may hear "well one or two shots is all you will need." This is a fallacious argument, when choosing the best option you cannot have too many rounds, only too few. Purposely ignoring a variable will get you nowhere.
Myth #2: You Don't Need to Aim a Shotgun PreciselyMany people seem to think 00 Buck will project a giant cone of death across their singlewide trailer destroying everything in it's path. In reality, most shotguns will print a group in HD ranges of less than an inch. It will never be enough to turn a miss with a carbine into a hit with a shotgun. Even if it was, that would mean only a pellet or two would hit, and a non expanding ball or two at shotgun velocity wouldn't be as reliable as a fragmenting round from a carbine or even a modern JHP from a handgun at that point. You need just as accurate of a shot with a shotgun to be effective as any other gun.
Myth #3: A Rifle for Home Defense?! Sure, if You Want to Kill Your Neighbors TooHere we get into external ballistics, which are pretty easy to understand and scientifically show results from, yet seem to be either too complicated or mystical wizard science to a lot of the gun world. The fact is anything that can kill a human being will penetrate walls without much trouble. Obviously though the less something penetrates walls the more desirable it is for HD, and the round that will penetrate the least amount of drywall/other common house barriers is a .223/5.56x45 JHP. The reason is these rounds tend to tumble or fragment on impact, while a heavier shotgun or handgun load will keep barreling through.
Here's a nice comparison test with several .223 loads, 9mm, .45acp, and 00 Buck illustrating this.
Myth #4: A Shotgun is the Most Reliable Man StopperIt will be easier to just look at gel tests for this one. Yes shotguns have a lot more lead to deliver, but at a much lower velocity with no fragmentation or tumble/yaw to speak of. For practical purposes both 00 Buck and 5.56 are more than sufficient.

Myth #5: The Shotgun is the Favorite of Entry TeamsThis is just not true, nearly every professional doorkicker whether it be LEO or military uses a carbine (or sometimes a pistol caliber SMG) these days. The only time you are going to see a shotgun used is against a doorknob. The other side of this coin is "well those are professionals, doesn't mean that's the right tool for me." But a carbine is just that, a tool. This analogy may work between an F1 car and your minivan, but those serve different purposes. Whether you are an 85 year old Canasta enthusiast or dragon slaying SEAL the carbine will serve you equally well for your own protection in a confined space.

when the FEMA death squad comes to take your guns, gold, and Alex Jones DVD boxed set they won't be using shotguns
Myth #6: Just the Sound of a Racking Shotgun will Cause any Intruder to Instantly SurrenderThis is probably the most popular and most absurd saying in the firearms world. First of all you should already have a round in the chamber, as a shotgun already starts with a capacity handicap, and the safety is there for a reason. Second of all, there is no way anyone is going to differentiate between a shotgun pump, sending the bolt home on a carbine, or the slide of a pistol anyway, and even if they could, they certainly aren't going to think "oh it's just a carbine, I'll just continue my murder/rape/robbery since that is unlikely to slow me down." All it will do in actuality is alert whoever is in your home where you are and remove a bit of an advantage you could have.
Myth #7: I'll Just Load 2 Shots of Birdshots as a Warning No! Using a firearm is always lethal force. Even shooting a beanbag or daffodils from your shotgun will be considered lethal force as far as law is concerned. If you plan on using it you need to use it correctly, and unless your home is being intruded by a pheasant birdshot is a horrible option. Let's say you wound a home intruder purposely: in court this intruder is now a down and out schizophrenic that couldn't afford his meds and accidentally went to the wrong house, or a guy who just lost his job that only wanted to get a birthday present for his child who is dying of Leukemia. This is the reality, however unfortunate, of our court system. If you use lethal force, make sure it's lethal, or you will be getting to know your 6'5 250 pound cellmate G-Ice quite intimately.

G Ice
There is one major benefit to a pump shotgun though: price. Personally I value my life more than a $150 Norinco Mossberg clone, but if you don't the shotgun may be the right choice for you. Some people also prefer handguns as they allow you to call the police or grab your wife/girlfriend/baby/Playstation with your off hand, and that's a consideration, but handguns are quite anemic and as the saying goes, only useful for fighting your way back to your carbine. Something like an AR-15 or a 5.56 or 5.45 AK with a proper defense load is light, easy to handle, requires nothing to use outside of flipping the safety off and pulling the trigger, and gives you 30 (or 10 if you live in a non free state) extremely effective rounds without the excessive recoil of a 12 gauge. It's also a lot more fun on the range as opposed to an 18" shotgun, which are primarily used for shooting pumpkins or making funny Youtube videos of
your redneck girlfriend shooting it at pumpkins, as opposed to practicing fundamental marksmanship/target shooting you can do with a carbine. Whatever you do end up choosing just make sure it's based on realistic needs and performance, not the Fudd Lore Handbook.