This is an understandably common question since the length of a firearm’s barrel and the overall length (OAL) of a firearm both factor into the determination of whether said firearm is regulated under the National Firearms Act (NFA).
The ATF covers this exact topic in Chapter 2 of the NFA Handbook.
Starting with barrel length they have this to say (emphasis added):
“The ATF procedure for measuring barrel length is to measure from the closed bolt (or breech-face) to the furthermost end of the barrel or permanently attached muzzle device. Permanent methods of attachment include full-fusion gas or electric steel-seam welding, high-temperature (1100°F) silver soldering, or blind pinning with the pin head welded over. Barrels are measured by inserting a dowel rod into the barrel until the rod stops against the bolt or breech-face. The rod is then marked at the furthermost end of the barrel or permanently attached muzzle device, withdrawn from the barrel, and measured.”
Now that we know a permanently attached muzzle device is considered an extension of the barrel we can turn to their definition of overall length:
“The overall length of a firearm is the distance between the muzzle of the barrel and the rearmost portion of the weapon measured on a line parallel to the axis of the bore.”
Some people find this definition concerning since it specifically says muzzle of the barrel but does not mention a permanently attached muzzle device as in the definition of barrel length above. However, they clearly intend it to be read as included since we see this comment later in the handbook concerning removing items from the purview of the NFA:
“For example, a shotgun with a barrel length of 15 inches is an NFA weapon. If the 15- inch barrel is removed and disposed of, the remaining firearm is not subject to the NFA because it has no barrel. Likewise, if the 15 inch barrel is modified by permanently attaching an extension such that the barrel length is at least 18 inches and the overall length of the weapon is at least 26 inches, the modified firearm is not subject to the NFA. NOTE: an acceptable method for permanently installing a barrel extension is by gas or electric steel seam welding or the use of high temperature silver solder having a flow point of 1100 degrees Fahrenheit.”
That interpretation is also in keeping with the actual federal regulation (27 CFR 479.11) which states:
“The overall length of a weapon made from a shotgun or rifle is the distance between the extreme ends of the weapon measured along a line parallel to the center line of the bore.”
Finally, the ATF has issued an opinion letter which goes into much greater detail than the NFA Handbook and which specifically answers this question (See Question 4 on Page 3 below).
In summary, the length of a permanently attached muzzle device is added to both the barrel length and the OAL of a firearm for purposes of evaluating whether said firearm falls under the purview of the NFA.