The 20 mm caliber is a specific size of cannon or ammunition.
There are few weapons (aside from shotguns, large game hunting rifles, and heavy caliber muzzleloading "rampart" or "wall guns" popular in the early mid 19th century European militaries) which have been built that fire projectiles between 12.7mm (such as the 12.7mm NATO) and 20 mm caliber, though there were several 13 mm heavy machine guns used during World War II, such as the MG 131; the 14.5 mm caliber is still used by some Soviet machine guns such as the KPV and anti-tank rifles such as PTRS, PTRD, and NTW-20. 15mm was also widely used by the Germans during WWII such as in the MG 151, and the British as well to a lesser extent in the 15mm version of the Besa machine gun which was used on Armored Cars and some Light Tanks.
Since 20mm is the cutoff point where most nations switch from bullets to shells, it has come to also generally be the cutoff point between weapons classified as a machine gun or a cannon. This can vary, however: for example, in World War II, Japan classified any weapon over 11 mm as a cannon; thus, in Japanese records, their 12.7 mm Ho-103 aircraft gun is classified as an autocannon, as it used explosive shells to overcome its lower muzzle velocity compared to American 12.7mm/.50BMG weapons. A machine gun does not fire shells, so historically a weapon that fires shells below 20 mm can be a cannon. A true definition will always mention whether the weapon fires bullets or shells in addition to its caliber.
A very small number of anti-tank rifles have been produced in 20 mm and larger calibers.
20 mm caliber cartridges have an outside bullet diameter and inside barrel diameter of 0.787 inches (20.0 mm). Projectiles or bullets are typically 75 to 127 mm (3–5 in) long. Cartridge cases are typically 75 to 152 mm (3–6 in) long. Many but not all 20 mm rounds have an explosive filling and detonating fuze.