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.
Rifling is characterized by its twist rate, which indicates the distance the rifling takes to complete one full revolution, such as "1 turn in 10 inches" (1:10 inches), "1 turn in 254 mm" ("1:254 mm" or "1:25.4 cm)", or the like. Normally, an experienced shooter can infer the units of measurement from the numbers alone. A shorter distance indicates a faster twist, meaning that for a given velocity the projectile will rotate at a higher spin rate. The combination of length, weight, and shape of a projectile determines the twist rate needed to gyroscopically stabilize it: barrels intended for short, large-diameter projectiles such as spherical lead balls require a very low twist rate, such as 1 turn in 48 inches (122 cm).  Barrels intended for long, small-diameter projectiles, such as the ultra-low-drag 80-grain 0.223 inch bullets (5.2 g, 5.56 mm), use twist rates of 1 turn in 8 inches (20 cm) or faster.  In some cases, rifling will increase the twist rate as the projectile travels down the length of the barrel, called a gain twist or progressive twist; a twist rate that decreases from breech to muzzle is undesirable because it cannot reliably stabilize the projectile as it travels down the bore.  
An extremely long projectile, such as a flechette, requires impractically high twist rates to stabilize; they are often stabilized aerodynamically instead. An aerodynamically stabilized projectile can be fired from a smoothbore barrel without a reduction in accuracy.
Muskets were smoothbore, large caliber weapons using ball-shaped ammunition fired at relatively low velocity. Due to the high cost, great difficulty of precision manufacturing, and the need to load readily and speedily from the muzzle, musket balls were generally a loose fit in the barrels. Consequently, on firing the balls would often bounce off the sides of the barrel when fired and the final destination after leaving the muzzle was less predictable. This was countered when accuracy was more important, for example when hunting, by using a tighter-fitting combination of a closer-to-bore-sized ball and a patch. The accuracy was improved, but still not reliable for precision shooting over long distances.
Like the invention of gunpowder itself, the inventor of barrel rifling is not yet definitely known. Straight grooving had been applied to small arms since at least 1480, originally intended as "soot grooves" to collect gunpowder residue. 
Some of the earliest recorded European attempts of spiral-grooved musket barrels were of Gaspard Kollner, a gunsmith of Vienna in 1498 and Augustus Kotter of Nuremberg in 1520. Some scholars allege that Kollner's works at the end of the 15th century only used straight grooves, and it wasn't until he received help from Kotter that a working spiral-grooved firearm was made.    There may have been attempts even earlier than this, as the main inspiration of rifled firearms came from archers and crossbowmen who realized that their projectiles flew far faster and more accurately when they imparted rotation through twisted fletchings.
Though true rifling dates from the 16th century, it had to be engraved by hand and consequently did not become commonplace until the mid-19th century. Due to the laborious and expensive manufacturing process involved, early rifled firearms were primarily used by wealthy recreational hunters, who did not need to fire their weapons many times in rapid succession and appreciated the increased accuracy. Rifled firearms were not popular with military users since they were difficult to clean, and loading projectiles presented numerous challenges. If the bullet was of sufficient diameter to take up the rifling, a large mallet was required to force it down the bore. If, on the other hand, it was of reduced diameter to assist in its insertion, the bullet would not fully engage the rifling and accuracy was reduced.
The first practical military weapons using rifling with black powder were breech loaders such as the Queen Anne pistol.
For best performance, the barrel should have a twist rate sufficient to spin stabilize any bullet that it would reasonably be expected to fire, but not significantly more. Large diameter bullets provide more stability, as the larger radius provides more gyroscopic inertia, while long bullets are harder to stabilize, as they tend to be very backheavy and the aerodynamic pressures have a longer arm ("lever") to act on. The slowest twist rates are found in muzzle-loading firearms meant to fire a round ball; these will have twist rates as low as 1 in 72 inches (180 cm), or slightly longer, although for a typical multi-purpose muzzleloader rifle, a twist rate of 1 in 48 inches (120 cm) is very common. The M16A2 rifle, which is designed to fire the 5.56×45mm NATO SS109 ball and L110 tracer bullets, has a 1 in 7-inch (18 cm) or 32 calibers twist. Civilian AR-15 rifles are commonly found with 1 in 12 inches (30 cm) or 54.8 calibers for older rifles and 1 in 9 inches (23 cm) or 41.1 calibers for most newer rifles, although some are made with 1 in 7 inches (18 cm) or 32 calibers twist rates, the same as used for the M16 rifle. Rifles, which generally fire longer, smaller diameter bullets, will in general have higher twist rates than handguns, which fire shorter, larger diameter bullets.
There are three methods in use to describe the twist rate:
The, traditionally speaking, most common method expresses the twist rate in terms of the 'travel' (length) required to complete one full projectile revolution in the rifled barrel. This method does not give an easy or straightforward understanding of whether a twist rate is relatively slow or fast when bores of different diameters are compared.
The second method describes the 'rifled travel' required to complete one full projectile revolution in calibers or bore diameters.
where is the twist rate expressed in bore diameters; is the twist length required to complete one full projectile revolution (in mm or in); and is the bore diameter (diameter of the lands, in mm or in).
The twist travel and the bore diameter must be expressed in a consistent unit of measure, i.e. metric (mm) or imperial (in).
The third method simply reports the angle of the grooves relative to the bore axis, measured in degrees.
Note that the latter two methods have the inherent advantage of expressing twist rate as a ratio and give an easy understanding if a twist rate is relatively slow or fast even when comparing bores of differing diameters.
In 1879, George Greenhill, a professor of mathematics at the Royal Military Academy (RMA) at Woolwich, London, UK  developed a rule of thumb for calculating the optimal twist rate for lead-core bullets. This shortcut uses the bullet's length, needing no allowances for weight or nose shape.  The eponymous Greenhill Formula, still used today, is:
where is 150 (use 180 for muzzle velocities higher than 2,800 f/s); is the bullet's diameter in inches; is the bullet's length in inches; and is the bullet's specific gravity (10.9 for lead-core bullets, which cancels out the second half of the equation)
The original value of was 150, which yields a twist rate in inches per turn, when given the diameter and the length of the bullet in inches. This works to velocities of about 840 m/s (2800 ft/s); above those velocities, a of 180 should be used. For instance, with a velocity of 600 m/s (2000 ft/s), a diameter of 0.5 inches (13 mm) and a length of 1.5 inches (38 mm), the Greenhill formula would give a value of 25, which means 1 turn in 25 inches (640 mm).
Improved formulas for determining stability and twist rates include the Miller Twist Rule  and the McGyro program  developed by Bill Davis and Robert McCoy.
If an insufficient twist rate is used, the bullet will begin to yaw and then tumble; this is usually seen as "keyholing", where bullets leave elongated holes in the target as they strike at an angle. Once the bullet starts to yaw, any hope of accuracy is lost, as the bullet will begin to veer off in random directions as it precesses.
Conversely, too high a rate of twist can also cause problems. The excessive twist can cause accelerated barrel wear, and coupled with high velocities also induce a very high spin rate which can cause projectile jacket ruptures causing high velocity spin stabilized projectiles to disintegrate in flight. Projectiles made out of mono metals cannot practically achieve flight and spin velocities such that they disintegrate in flight due to their spin rate.  Smokeless powder can produce muzzle velocities of approximately 1,600 m/s (5,200 ft/s) for spin stabilized projectiles and more advanced propellants used in smoothbore tank guns can produce muzzle velocities of approximately 1,800 m/s (5,900 ft/s).  A higher twist than needed can also cause more subtle problems with accuracy: Any inconsistency within the bullet, such as a void that causes an unequal distribution of mass, may be magnified by the spin. Undersized bullets also have problems, as they may not enter the rifling exactly concentric and coaxial to the bore, and excess twist will exacerbate the accuracy problems this causes.
A bullet fired from a rifled barrel can spin at over 300,000 rpm (5 kHz), depending on the bullet's muzzle velocity and the barrel's twist rate.
The general definition of the spin of an object rotating around a single axis can be written as
where is the linear velocity of a point in the rotating object (in units of distance/time) and refers to the circumference of the circle that this measuring point performs around the axis of rotation.
A bullet that matches the rifling of the firing barrel will exit that barrel with a spin
where is the muzzle velocity and is the twist rate. 
For example, an M4 Carbine with a twist rate of 1 in 7 inches (177.8 mm) and a muzzle velocity of 3,050 feet per second (930 m/s) will give the bullet a spin of 930 m/s / 0.1778 m = 5.2 kHz (314,000 rpm).
Excessive rotational speed can exceed the bullet's designed limits and the resulting centrifugal force can cause the bullet to disintegrate radially during flight. 
A barrel of circular bore cross-section is not capable of imparting a spin to a projectile, so a rifled barrel has a non-circular cross-section. Typically the rifled barrel contains one or more grooves that run down its length, giving it a cross-section resembling an internal gear, though it can also take the shape of a polygon, usually with rounded corners. Since the barrel is not circular in cross-section, it cannot be accurately described with a single diameter. Rifled bores may be described by the bore diameter (the diameter across the lands or high points in the rifling), or by groove diameter (the diameter across the grooves or low points in the rifling). Differences in naming conventions for cartridges can cause confusion; for example, the projectiles of the .303 British are actually slightly larger in diameter than the projectiles of the .308 Winchester, because the ".303" refers to the bore diameter in inches (bullet is .312), while the ".308" refers to the bullet diameter in inches (7.92 mm and 7.82 mm, respectively).
Despite differences in form, the common goal of rifling is to deliver the projectile accurately to the target. In addition to imparting the spin to the bullet, the barrel must hold the projectile securely and concentrically as it travels down the barrel. This requires that the rifling meet a number of tasks: 
Rifling may not begin immediately forward of the chamber. There may be an unrifled throat ahead of the chamber so a cartridge may be chambered without pushing the bullet into the rifling. This reduces the force required to load a cartridge into the chamber, and prevents leaving a bullet stuck in the rifling when an unfired cartridge is removed from the chamber. The specified diameter of the throat may be somewhat greater than groove diameter, and may be enlarged by use if hot powder gas melts the interior barrel surface when the rifle is fired.  Freebore is a groove-diameter length of smoothbore barrel without lands forward of the throat. Freebore allows the bullet to transition from static friction to sliding friction and gain linear momentum prior to encountering the resistance of increasing rotational momentum. Freebore may allow more effective use of propellants by reducing the initial pressure peak during the minimum volume phase of internal ballistics before the bullet starts moving down the barrel. Barrels with freebore length exceeding the rifled length have been known by a variety of trade names including paradox. 
An early method of introducing rifling to a pre-drilled barrel was to use a cutter mounted on a square-section rod, accurately twisted into a spiral of the desired pitch, mounted in two fixed square-section holes. As the cutter was advanced through the barrel it twisted at a uniform rate governed by the pitch. The first cut was shallow. The cutter points were gradually expanded as repeated cuts were made. The blades were in slots in a wooden dowel which were gradually packed out with slips of paper until the required depth was obtained. The process was finished off by casting a slug of molten lead into the barrel, withdrawing it and using it with a paste of emery and oil to smooth the bore. 
Most rifling is created by either:
The grooves are the spaces that are cut out, and the resulting ridges are called lands. These lands and grooves can vary in number, depth, shape, direction of twist (right or left), and twist rate. The spin imparted by rifling significantly improves the stability of the projectile, improving both range and accuracy. Typically rifling is a constant rate down the barrel, usually measured by the length of travel required to produce a single turn. Occasionally firearms are encountered with a gain twist, where the rate of spin increases from chamber to muzzle. While intentional gain twists are rare, due to manufacturing variance, a slight gain twist is in fact fairly common. Since a reduction in twist rate is very detrimental to accuracy, gunsmiths who are machining a new barrel from a rifled blank will often measure the twist carefully so they may put the faster rate, no matter how minute the difference is, at the muzzle end.
The original firearms were loaded from the muzzle by forcing a ball from the muzzle to the chamber. Whether using a rifled or smooth bore, a good fit was needed to seal the bore and provide the best possible accuracy from the gun. To ease the force required to load the projectile, these early guns used an undersized ball, and a patch made of cloth, paper, or leather to fill the windage (the gap between the ball and the walls of the bore). The patch acted as a wadding and provided some degree of pressure sealing, kept the ball seated on the charge of black powder, and kept the ball concentric to the bore. In rifled barrels, the patch also provided a means to transfer the spin from the rifling to the bullet, as the patch is engraved rather than the ball. Until the advent of the hollow-based Minié ball, which expands and obturates upon firing to seal the bore and engage the rifling, the patch provided the best means of getting the projectile to engage the rifling. 
In breech-loading firearms, the task of seating the projectile into the rifling is handled by the throat of the chamber. Next is the freebore, which is the portion of the throat down which the projectile travels before the rifling starts. The last section of the throat is the throat angle, where the throat transitions into the rifled barrel.
The throat is usually sized slightly larger than the projectile, so the loaded cartridge can be inserted and removed easily, but the throat should be as close as practical to the groove diameter of the barrel. Upon firing, the projectile expands under the pressure from the chamber, and obturates to fit the throat. The bullet then travels down the throat and engages the rifling, where it is engraved, and begins to spin. Engraving the projectile requires a significant amount of force, and in some firearms there is a significant amount of freebore, which helps keep chamber pressures low by allowing the propellant gases to expand before being required to engrave the projectile. Minimizing freebore improves accuracy by decreasing the chance that a projectile will distort before entering the rifling.  
When the projectile is swaged into the rifling, it takes on a mirror image of the rifling, as the lands push into the projectile in a process called engraving. Engraving takes on not only the major features of the bore, such as the lands and grooves, but also minor features, like scratches and tool marks. The relationship between the bore characteristics and the engraving on the projectile are often used in forensic ballistics.
The grooves most commonly used in modern rifling have fairly sharp edges. More recently, polygonal rifling, a throwback to the earliest types of rifling, has become popular, especially in handguns. Polygonal barrels tend to have longer service lives because the reduction of the sharp edges of the land (the grooves are the spaces that are cut out, and the resulting ridges are called lands) reduces erosion of the barrel. Supporters of polygonal rifling also claim higher velocities and greater accuracy. Polygonal rifling is currently seen on pistols from CZ, Heckler & Koch, Glock, Tanfoglio, and Kahr Arms, as well as the Desert Eagle.
For field artillery pieces, the extended range, full bore (ERFB) concept developed in early 1970s by Dennis Hyatt Jenkins and Luis Palacio  of Gerald Bull's Space Research Corporation for the GC-45 howitzer replaces the bourrelet with small nubs, which both tightly fit into lands of the barrel.   Guns capable of firing these projectiles have achieved significant increases in range, but this is compensated with a significantly (3-4 times) decreased accuracy, due to which they were not adopted by NATO militaries.  Unlike a shell narrower than the gun's bore with a sabot, ERFB shells use the full bore, permitting a larger payload. Examples include the South African G5 and the German PzH 2000. ERFB may be combined with base bleed.
A gain-twist or progressive rifling begins with a slow twist rate that gradually increases down the bore, resulting in very little initial change in the projectile's angular momentum during the first few inches of bullet travel after it enters the throat. This enables the bullet to remain essentially undisturbed and trued to the case mouth. After engaging the rifling at the throat, the bullet is progressively subjected to accelerated angular momentum as it gets propelled down the barrel. The theoretical advantage is that by gradually increasing the spin rate, torque gets imparted along a much longer bore length, allowing thermomechanical stress to be spread over a larger area rather than being focused predominantly at the throat, which typically wears out much faster than other parts of the barrel. Gain-twist rifling was used prior to and during the American Civil War (1861–65). Colt Army and Navy revolvers both employed gain-twist rifling. Gain-twist rifling, however, is more difficult to produce than uniform rifling, and therefore is more expensive. The military has used gain-twist rifling in a variety of weapons such as the 20 mm M61 Vulcan Gatling gun used in some current fighter jets and the larger 30 mm GAU-8 Avenger Gatling gun used in the A10 Thunderbolt II close air support jet. In these applications it allows lighter construction of the barrels by decreasing chamber pressures through the use of low initial twist rates but ensuring the projectiles have sufficient stability once they leave the barrel. It is seldom used in commercially available products, though notably on the Smith & Wesson Model 460 (X-treme Velocity Revolver). 
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.
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 US "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.
Muzzle velocity is the speed of a projectile with respect to the muzzle at the moment it leaves the end of a gun's barrel. Firearm muzzle velocities range from approximately 120 m/s (390 ft/s) to 370 m/s (1,200 ft/s) in black powder muskets, to more than 1,200 m/s (3,900 ft/s) in modern rifles with high-velocity cartridges such as the .220 Swift and .204 Ruger, all the way to 1,700 m/s (5,600 ft/s) for tank guns firing kinetic energy penetrator ammunition. To simulate orbital debris impacts on spacecraft, NASA launches projectiles through light-gas guns at speeds up to 8,500 m/s (28,000 ft/s).
A driving band or rotating band is a band of soft metal near the base of an artillery shell, often made of gilding metal, copper, or lead. When the shell is fired, the pressure of the propellant swages the metal into the rifling of the barrel and forms a seal; this seal prevents the gases from blowing past the shell, and engages the barrel's rifling to spin-stabilize the shell.
A sabot is a supportive device used in firearm/artillery ammunitions to fit/patch around a projectile, such as a bullet/slug or a flechette-like projectile, and keep it aligned in the center of the barrel when fired. It allows a narrower projectile with high sectional density to be fired through a barrel of much larger bore diameter with maximal accelerative transfer of kinetic energy. After leaving the muzzle, the sabot typically separates from the projectile in flight, diverting only a very small portion of the overall kinetic energy.
A smoothbore weapon is one that has a barrel without rifling. Smoothbores range from handheld firearms to powerful tank guns and large artillery mortars.
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 .338 Lapua Magnum is a rimless, bottlenecked, centerfire rifle cartridge. It was developed during the 1980s as a high-powered, long-range cartridge for military snipers. It was used in the War in Afghanistan and the Iraq War. As a result of this, it has become widely available.
Internal ballistics, a subfield of ballistics, is the study of the propulsion of a projectile.
The .223 Remington is a rimless, bottlenecked rifle cartridge. It was developed in 1957 by Remington Arms and Fairchild Industries for the U.S. Continental Army Command of the United States Army as part of a project to create a small-caliber, high-velocity firearm. The .223 Remington is considered one of the most popular common-use cartridges and is currently used by a wide range of semi-automatic and manual-action rifles as well as handguns.
Accurizing is the process of improving the accuracy and precision of a gun.
A shotgun slug is a heavy projectile made of lead, copper, or other material and fired from a shotgun. Slugs are designed for hunting large game, and other uses, particularly in areas near human population where their short range and slow speed helps increase safety margin. The first effective modern shotgun slug was introduced by Wilhelm Brenneke in 1898, and his design remains in use today. Most shotgun slugs are designed to be fired through a cylinder bore, improved cylinder choke, rifled choke tubes, or fully rifled bores. Slugs differ from round ball lead projectiles in that they are stabilized in some manner.
A rifled musket, rifle musket, or rifle-musket is a type of firearm made in the mid-19th century. Originally the term referred only to muskets that had been produced as a smoothbore weapon and later had their barrels replaced with rifled barrels. The term later included rifles that directly replaced, and were of the same design overall as, a particular model of smoothbore musket.
Polygonal rifling is a type of gun barrel rifling where the traditional sharp-edged "lands and grooves" are replaced by less pronounced "hills and valleys", so the barrel bore has a polygonal cross-sectional profile.
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 .408 Cheyenne Tactical is a specialized rimless, bottlenecked, centerfire cartridge for military long-range sniper rifles that was developed by Dr. John D. Taylor and machinist William O. Wordman. The round was designed with a possible military need for a cartridge for anti-personnel, anti-sniper, and anti-materiel roles with a (supersonic) precision range of 2,200 yards. It is offered as a competitor to the most common military NATO long-range service cartridges such as .338 Lapua Magnum and the .50 BMG.
The Whitworth rifle was an English-made percussion rifle used in the latter half of the 19th century. A single-shot muzzleloader with excellent long-range accuracy for its era, especially when used with a telescopic sight, the Whitworth rifle was widely regarded as the world's first sniper rifle.
The following are terms related to firearms and ammunition topics.
In artillery, caliber or calibre is the internal diameter of a gun barrel, or, by extension, a relative measure of the barrel length.
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.