What is the "best" length of barrel for an AR?
This is a question many first-time AR buyers have, but there are very few solid answers on the web. Many more, in my experience, don't comprehend the significance of this choice until they've had the chance to shoot more and try other people's guns. (And, come to understand the laws concerning barrel length in the US.) Many don't understand, or even know they should consider, the Dwell Time that a particular barrel offers or the effects of barrel length on velocity or lethality. I know from personal experience and seeing my friends go through stages of understanding of the rifle's system that you won't know what you really like or what works best for you until you get enough experience to form an opinion. I hope to speed up that process for my readers.
The first aspect to consider is the law. Legally, a Centerfire Rifle Barrel must be at least 16" long. The only ways to circumvent that are:
1. You pin and weld a flash suppressor, or other muzzle device, to the barrel, such that the total length is at least 16" after the addition of this device. (Highly recommended that you have a professional do this.)
2. You fill out an NFA form, submit to the much stricter background check (which includes fingerprints), spend $200 on a tax stamp, and wait 6 months for approval to exercise your natural-born right to keep and bear arms that the US Government is expressly forbidden from infringing upon.
3. You use a Pistol Brace, bearing in mind the possible repercussions of the wrong person getting elected and the Pistol braces no longer being legally allowed without a Stamp. You also have to know the legal requirements of a pistol. For example, you can't use a forward vert grip on a pistol without submitting some kind of NFA paperwork, which defeats the entire purpose of making a pistol instead of an SBR, as in point 2 above.
In case you can't tell, I'm not a fan of the NFA of 1934, Gun Control Act of 1968, or the Hughes Amendment of 1986. However, unless you want to be (unconstitutionally) arrested and possibly charged or convicted of a Felony, then you need to follow the law, regardless of what length you choose.
The second point to consider is effectiveness of the projectiles leaving the barrel. A 20" barrel will provide additional velocity and, therefore, distance over a 16" barrel that is the same in all other ways, besides length. That velocity also provides more lethality - as mass or velocity increase, all other things being equal, the kinetic (aka muzzle) energy increases. The key down side of having a longer barrel is how easy/hard it is to maneuver in tight spaces, such as within a hallway in your home. You also have to think about weight of the gun because the barrel is typically the heaviest part of the gun. The longer the barrel, the more heavy the gun is. (More front heavy, at that!)
The third point is just as crucial. Dwell Time is something many people don't understand, but it is absolutely critical to the reliable function of the gun and smoothness of the action. Dwell time is how long the bullet spends in the barrel after passing the gas block. (More precisely, the port under the gas block that funnels gas back into the gun and causes the action to cycle automatically.) Another way of figuring this is to measure from the gas port to the crown/tip of the barrel to ensure there is enough distance there to send enough gas, through the gas tube, back in the receiver to cycle the action reliably. In order to get the dwell time needed on shorter barrels, you have pistol and carbine-length gas systems that shorten the distance between the gas port and the receiver. Bear in mind that the closer the gas port is to the receiver, the more carbon fouling you will encounter in the receiver. Generally speaking, shorter barrel = dirtier gun. The more Dwell Time you have, the more violently the gun will cycle. (Harder on the parts and the shooter, as well as worse for follow-up shots.) Too much Dwell Time can cause malfunctions, but having more than is needed also helps to cycle cheap ammo with low amounts of gunpowder or steel casings. Too little Dwell Time and you end up with a rifle that can't push the bolt carrier back far enough to chamber the next round. This is something you want to match to your gun because you have to balance various combinations of Bolt Carriers, Buffers, Buffer Springs, Barrel lengths, and Gas System lengths - balance it so that the BCG cycles at the right rate and correct force.
In general, for an AR15, I find that a mid-length gas, 16" barrel provides adequate dwell time to cycle the gun, adequate velocity leaving the barrel, and is not so long as to be cumbersome in a hallway. I would only buy a longer barrel for a purpose-built rifle intended to be a 500+ yard target shooter or Designated Marksman Rifle. And, I don't see such a major need for a shorter barrel that I would invest $200 in a tax stamp. If laws changed in our favor, I would prefer an 11 or 12 inch barrel for a purpose-built home defense rifle. As it is, if you could only afford one AR15, I wouldn't waste money on a tax stamp or spend the money on a pin and weld job. And, one can reliably reach out to 500 yards with a 16" barrel, so I wouldn't spend the extra weight to get a longer barrel and 50, or so, yards of effective range.
So, what do I recommend? For me and for most people, I would highly recommend 16" barrels with mid-length gas ports for any general purpose AR15. This combination produces, possibly, the most reliable and some of the softest shooting ARs one can make. This length of Gas System, combined with that length of barrel, is a great combination that is proven and will work better than most (if not all) combinations of factors. Save yourself the money and the weight and get a 16" barrel with a Mid-Length gas. You'll really appreciate it after comparing it to a friend's carbine-length "milspec" rifle. As a rule, if you do go for a Short Barreled Rifle or a Pistol build, I would recommend not going below 10.5" for 5.56 chambered ARs. I would also want pistol or carbine length gas systems on shorter barrels, specifically to improve dwell time.