A gun barrel is a crucial part of gun-type weapons such as small firearms, artillery pieces, and air guns. It is the straight shooting tube, usually made of rigid high-strength metal, through which a contained rapid expansion of high-pressure gas(es) is used to propel a projectile out of the front end (muzzle) at a high velocity. The hollow interior of the barrel is called the bore, and the diameter of the bore is called its caliber, usually measured in inches or millimetres.
The first firearms were made at a time when metallurgy was not advanced enough to cast tubes capable of withstanding the explosive forces of early cannons, so the pipe (often built from staves of metal) needed to be braced periodically along its length for structural reinforcement, producing an appearance somewhat reminiscent of storage barrels being stacked together, hence the English name. 
Gun barrels are usually metal. However, the early Chinese, the inventors of gunpowder, used bamboo, which has a strong, naturally tubular stalk and is cheaper to obtain and process, as the first barrels in gunpowder projectile weapons such as the fire lances.  The Chinese were also the first to master cast-iron cannon barrels, and used the technology to make the earliest infantry firearms — the hand cannons. Early European guns were made of wrought iron, usually with several strengthening bands of the metal wrapped around circular wrought iron rings and then welded into a hollow cylinder.  Bronze and brass were favoured by gunsmiths, largely because of their ease of casting and their resistance to the corrosive effects of the combustion of gunpowder or salt water when used on naval vessels. 
Early firearms were muzzle-loading, with the gunpowder and then the shot loaded from the front end (muzzle) of the barrel, and were capable of only a low rate of fire due to the cumbersome loading process. The later-invented breech-loading designs provided a higher rate of fire, but early breechloaders lacked an effective way of sealing the escaping gases that leaked from the back end (breech) of the barrel, reducing the available muzzle velocity.  During the 19th century, effective breechblocks were invented that sealed a breechloader against the escape of propellant gases. 
Early cannon barrels were very thick for their caliber. This was because manufacturing defects such as air bubbles trapped in the metal were common at that time, and played key factors in many gun explosions; these defects made the barrel too weak to withstand the pressures of firing, causing it to fail and fragment explosively. 
A gun barrel must be able to hold in the expanding gas produced by the propellants to ensure that optimum muzzle velocity is attained by the projectile as it is being pushed out. If the barrel material cannot cope with the pressure within the bore, the barrel itself might suffer catastrophic failure and explode, which will not only destroy the gun but also present a life-threatening danger to people nearby. Modern small arms barrels are made of carbon steel or stainless steel materials known and tested to withstand the pressures involved. Artillery pieces are made by various techniques providing reliably sufficient strength.  
Fluting is the removal of material from a cylindrical surface, usually creating rounded grooves, for the purpose of reducing weight. This is most often done to the exterior surface of a rifle barrel, though it may also be applied to the cylinder of a revolver or the bolt of a bolt-action rifle. Most flutings on rifle barrels and revolver cylinders are straight, though helical flutings can be seen on rifle bolts and occasionally also rifle barrels.
While the main purpose of fluting is just to reduce weight and improve portability, when adequately done it can retain the structural strength and rigidity and increase the overall specific strength. Fluting will also increase the surface-to-volume ratio and make the barrel more efficient to cool after firing, though the reduced material mass also means the barrel will heat up easily during firing.
A composite barrel is a firearm barrel that has been shaved down to be thinner and an exterior sleeve slipped over and fused to it that improves rigidity, weight and cooling. Most common form of composite barrel are those with carbon fiber sleeves, but there are proprietary examples such as the Teludyne Tech Straitjacket. They are seldom used outside sports and competition shooting.
A barrel can be fixed to the receiver using action threads or similar methods.
The chamber is the cavity at the back end of a breech-loading gun's barrel where the cartridge is inserted in position ready to be fired. In most firearms (rifles, shotguns, machine guns and pistols), the chamber is an integral part of the barrel, often made by simply reaming the rear bore of a barrel blank, with a single chamber within a single barrel. In revolvers, the chamber is a component of the gun's cylinder and completely separate from the barrel, with a single cylinder having multiple chambers that are rotated in turns into alignment with the barrel in anticipation of being fired.
Structurally, the chamber consists of the body, shoulder and neck, the contour of which closely correspond to the casing shape of the cartridge it is designed to hold. The rear opening of the chamber is the breech of the whole barrel, which is sealed tight from behind by the bolt, making the front direction the path of least resistance during firing. When the cartridge's primer is struck by the firing pin, the propellant is ignited and deflagrates, generating high-pressure gas expansion within the cartridge case. However, the chamber (closed from behind by the bolt) restrains the cartridge case (or shell for shotguns) from moving, allowing the bullet (or shot/slug in shotguns) to separate cleanly from the casing and be propelled forward along the barrel to exit out of the front (muzzle) end as a flying projectile.
Chambering a gun is the process of loading a cartridge into the gun's chamber, either manually as in single loading, or via operating the weapon's own action as in pump action, lever action, bolt action or self-loading actions. In the case of an air gun, a pellet (or slug) itself has no casing to be retained and will be entirely inserted into the chamber (often called "seating" or "loading" the pellet, rather than "chambering" it) before a mechanically pressurized gas is released behind the pellet and propels it forward, meaning that an air gun's chamber is functionally equivalent to the freebore portion of a firearm barrel.
In the context of firearms design, manufacturing and modification, the word "chambering" has a different meaning, and refers to fitting a weapon's chamber specifically to fire a particular caliber or model of cartridge.
The bore is the hollow internal lumen of the barrel, and takes up a vast majority portion of the barrel length. It is the part of the barrel where the projectile (bullet, shot, or slug) is located prior to firing and where it gains speed and kinetic energy during the firing process. The projectile's status of motion while travelling down the bore is referred to as its internal ballistics.
Most modern firearms (except muskets, shotguns, most tank guns, and some artillery pieces) and air guns (except some BB guns) have helical grooves called riflings machined into the bore wall. When shooting, a rifled bore imparts spin to the projectile about its longitudinal axis, which gyroscopically stabilizes the projectile's flight attitude and trajectory after its exit from the barrel (i.e. the external ballistics). Any gun without riflings in the bore is called a smoothbore gun.
When a firearm cartridge is chambered, its casing occupies the chamber but its bullet actually protrudes beyond the chamber into the posterior end of the bore. Even in a rifled bore, this short rear section is without rifling, and allows the bullet an initial "run-up" to build up momentum before encountering riflings during shooting. The most posterior part of this unrifled section is called a freebore, and is usually cylindrical. The portion of the unrifled bore immediately front of the freebore, called the leade, starts to taper slightly and guides the bullet towards the area where the riflingless bore transitions into fully rifled bore. Together they form the throat region, where the riflings impactfully "bite" into the moving bullet during shooting. The throat is subjected to the greatest thermomechanical stress and therefore suffers wear the fastest. Throat erosion is often the main determining factor of a gun's barrel life.
The muzzle is the front end of a barrel from which the projectile will exit.  Precise machining of the muzzle is crucial to accuracy, because it is the last point of contact between the barrel and the projectile. If inconsistent gaps exist between the muzzle and the projectile, escaping propellant gases may spread unevenly and deflect the projectile from its intended path (see transitional ballistics). The muzzle can also be threaded on the outside to allow the attachment of different accessory devices.
In rifled barrels, the contour of a muzzle is designed to keep the rifling safe from damage by intruding foreign objects, so the front ends of the rifling grooves are commonly protected behind a recessed crown, which also serves to modulate the even expansion of the propellant gases. The crown itself is often recessed from the outside rim of the muzzle to avoid accidental damage from collision with the surrounding environment.
In smooth bore barrels firing multiple sub-projectiles (such as shotgun shot), the bore at the muzzle end might have a tapered constriction called choke to shape the scatter pattern for better range and accuracy. Chokes are implemented as either interchangeable screw-in chokes for particular applications, or as fixed permanent chokes integral to the barrel.
During firing, a bright flash of light known as a muzzle flash is often seen at the muzzle. This flash is produced by both superheated propellant gases radiating energy during expansion (primary flash), and the incompletely combusted propellant residues reacting vigorously with the fresh supply of ambient air upon escaping the barrel (secondary flash). The size of the flash depends on factors such as barrel length (shorter barrels have less time for complete combustion, hence more unburnt powder), the type (fast- vs. slow-burning) and amount of propellant (higher total amount means likely more unburnt residues) loaded in the cartridge. Flash suppressors or muzzle shrouds can be attached to the muzzle of the weapon to either diminish or conceal the flash. 
The rapid expansion of propellant gases at the muzzle during firing also produce a powerful shockwave known as a muzzle blast . The audible component of this blast, also known as a muzzle report, is the loud "bang" sound of gunfire that can easily exceed 140 decibels and cause permanent hearing loss to the shooter and bystanders. The non-audible component of the blast is an infrasonic overpressure wave that can cause damage to nearby fragile objects. Accessory devices such as muzzle brakes and muzzle boosters can be used to redirect muzzle blast in order to counter the recoil-induced muzzle rise or to assist the gas operation of the gun, and suppressors (and even muzzle shrouds) can be used to reduce the blast noise intensity felt by nearby personnel.
A firearm is any type of gun designed to be readily carried and used by an individual. The term is legally defined further in different countries.
A rifle is a long-barreled firearm designed for accurate shooting, with a barrel that has a helical pattern of grooves (rifling) cut into the bore wall. In keeping with their focus on accuracy, rifles are typically designed to be held with both hands and braced firmly against the shooter's shoulder via a buttstock for stability during shooting. Rifles are used extensively in warfare, law enforcement, hunting, shooting sports, and crime.
A shotgun is a long-barreled firearm designed to shoot a straight-walled cartridge known as a shotshell, which usually discharges numerous small pellet-like spherical sub-projectiles called shot, or sometimes a single solid projectile called a slug. Shotguns are most commonly smoothbore firearms, meaning that their gun barrels have no rifling on the inner wall, but rifled barrels for shooting slugs are also available.
A bullet is a kinetic projectile, a component of firearm ammunition that is shot from a gun barrel. They are made of a variety of materials, such as copper, lead, steel, polymer, rubber and even wax; and are made in various shapes and constructions, including specialized functions such as hunting, target shooting, training and combat. Bullets are often tapered, making them more aerodynamic. Bullet size is expressed by weight and diameter in both imperial and metric measurement systems. Bullets do not normally contain explosives but strike or damage the intended target by transferring kinetic energy upon impact and penetration.
A cartridge or a round is a type of pre-assembled firearm ammunition packaging a projectile, a propellant substance and an ignition device (primer) within a metallic, paper, or plastic case that is precisely made to fit within the barrel chamber of a breechloading gun, for the practical purpose of convenient transportation and handling during shooting. Although in popular usage the term "bullet" is often informally used to refer to a complete cartridge, it is correctly used only to refer to the projectile.
A muzzleloader is any firearm into which the projectile and the propellant charge is loaded from the muzzle of the gun. This is distinct from the modern designs of breech-loading firearms. The term "muzzleloader" applies to both rifled and smoothbore type muzzleloaders, and may also refer to the marksman who specializes in the shooting of such firearms. The firing methods, paraphernalia and mechanism further divide both categories as do caliber.
In firearms, rifling is machining helical grooves into the internal (bore) surface of a gun's barrel for the purpose of exerting torque and thus imparting a spin to a projectile around its longitudinal axis during shooting to stabilize the projectile longitudinally by conservation of angular momentum, improving its aerodynamic stability and accuracy over smoothbore designs.
In firearms terminology, an action is the functional mechanism of a breech-loading firearm that handles the ammunition cartridges, or the method by which that mechanism works. Actions are technically not present on muzzleloaders, as all those are single-shot firearms with a closed off breech with the powder and projectile manually loaded from the muzzle. Instead, the muzzleloader ignition mechanism is referred to as the lock.
In guns, particularly firearms, caliber is the specified nominal internal diameter of the gun barrel bore – regardless of how or where the bore is measured and whether the finished bore matches that specification. It is measured in inches or in millimeters. In the United States it is expressed in hundredths of an inch; in the United Kingdom in thousandths; and elsewhere in millimeters. For example, a "45 caliber" firearm has a barrel diameter of roughly 0.45 inches (11 mm). Barrel diameters can also be expressed using metric dimensions. For example, a "9 mm pistol" has a barrel diameter of about 9 millimeters. Since metric and US customary units do not convert evenly at this scale, metric conversions of caliber measured in decimal inches are typically approximations of the precise specifications in non-metric units, and vice versa.
A breechloader is a firearm in which the user loads the ammunition via the rear (breech) end of its barrel, as opposed to a muzzleloader, which loads ammunition via the front (muzzle).
Caseless ammunition (CL), or rather caseless cartridge, is a configuration of weapon-cartridge that eliminates the cartridge case that typically holds the primer, propellant and projectile together as a unit. Instead, the propellant and primer are fitted to the projectile in another way so that a cartridge case is not needed, for example inside or outside the projectile depending on configuration.
Internal ballistics, a subfield of ballistics, is the study of the propulsion of a projectile.
A blank is a firearm cartridge that, when fired, does not shoot a projectile like a bullet or pellet, but generates a muzzle flash and an explosive sound like a normal gunshot would. Firearms may need to be modified to allow a blank to cycle the action, and the shooter experiences less recoil with a blank than with a live round. Blanks are often used in prop guns for shooting simulations that have no need for ballistic results, but still demand light and sound effects, such as in historical reenactments, special effects for theatre, movie and television productions, combat training, for signaling, and cowboy mounted shooting. Specialised blank cartridges are also used for their propellant force in fields as varied as construction, shooting sports, and fishing and general recreation.
Blowback is a system of operation for self-loading firearms that obtains energy from the motion of the cartridge case as it is pushed to the rear by expanding gas created by the ignition of the propellant charge.
In the field of firearms and airguns, obturation denotes necessary barrel blockage or fit by a deformed soft projectile. A bullet or pellet, made of soft material and often with a concave base, will flare under the heat and pressure of firing, filling the bore and engaging the barrel's rifling. The mechanism by which an undersized soft-metal projectile enlarges to fill the barrel is, for hollow-base bullets, expansion from gas pressure within the base cavity and, for solid-base bullets, "upsetting"—the combined shortening and thickening that occurs when a malleable metal object is struck forcibly at one end.
A muzzle-loading rifle is a muzzle-loaded small arm or artillery piece that has a rifled barrel rather than a smoothbore. The term "rifled muzzle loader" typically is used to describe a type of artillery piece, although it is technically accurate for small arms as well. A shoulder arm is typically just called a "rifle", as almost all small arms were rifled by the time breechloading became prevalent. Muzzle and breechloading artillery served together for several decades, making a clear distinction more important. In the case of artillery, the abbreviation "RML" is often prefixed to the guns designation; a Rifled breech loader would be "RBL", or often just "BL", since smoothbore breechloading artillery is almost nonexistent. A muzzle loading weapon is loaded through the muzzle, or front of the barrel. This is the opposite of a breech-loading weapon or rifled breechloader (RBL), which is loaded from the breech-end of the barrel. The rifling grooves cut on the inside of the barrel cause the projectile to spin rapidly in flight, giving it greater stability and hence range and accuracy than smoothbore guns. Hand held rifles were well-developed by the 1740s. A popularly recognizable form of the "muzzleloader" is the Kentucky Rifle, which was actually developed in Pennsylvania. The American Longrifle evolved from the German "Jäger" rifle.
The following are terms related to firearms and ammunition topics.
A gun is a ranged weapon designed to use a shooting tube to launch projectiles. The projectiles are typically solid, but can also be pressurized liquid, gas or even charged particles. Solid projectiles may be free-flying or tethered. A large-caliber gun is also called a cannon.
Recoil operation is an operating mechanism used to implement locked breech, autoloading firearms. Recoil operated firearms use the energy of recoil to cycle the action, as opposed to gas operation or blowback operation using the pressure of the propellant gas.
In firearms, freebore is the portion of the gun barrel between the chamber and the rifled section of the barrel bore. The freebore is located just forward of the chamber neck and is cylindrical in shape. The diameter of the freebore is larger than the groove diameter of the gun barrel bore so that no rifling is present and projectiles used in the firearm can accelerate through the freebore without resistance.