Code cylinders, also known under various names like coded rank cylinders, security rank cylinders, coded key cylinders, and data cylinders, functioned as security devices. These devices, resembling compact cylinders, were utilized by the Galactic Empire and, some decades later, by the First Order. These cylinders stored encoded data about the individuals carrying them, enabling access to restricted zones through the use of scomp links. It was a common practice for high-level personnel to possess multiple code cylinders, each containing unique encrypted access codes.

Imperial code cylinders served at least a dual purpose. Primarily, they housed encoded information about the carrier, detailing cleared access points and read files. A thorough examination of the cylinder's stored data would allow the Imperial Security Bureau to pinpoint the owner's exact locations on an Imperial vessel or within an installation. Furthermore, these code cylinders granted the user different levels of entry to restricted locations and terminals, encompassing but not limited to detention levels and office spaces. In addition to area access, it's worth noting that there were different Code Cylinder classifications. Updated code cylinders were provided with each promotion in clearance level or upon receiving a new assignment. Given the complexity of the replacement procedures and paperwork, code cylinder holders were extremely careful to avoid losing them. The loss of a high-ranking code cylinder presented the risk of disciplinary measures, as it could enable potential intruders to breach Imperial facilities and acquire sensitive information or gain access to critical areas. Depending on the circumstances surrounding the loss, such as accidental loss or loss due to enemy action, the responsible officer could even face execution for treason.
The Galactic Empire employed a minimum of four distinct physical designs for code cylinders, identifiable by the bearer's rank insignia plaque featuring red and blue tiles; the cylinders' appearance conveyed the owner's rank to other personnel. The first type, carried by officers such as Grand Moff Wilhuff Tarkin, Admiral Kendal Ozzel, and General Maximilian Veers, featured a torus-shaped activator tip in blue or red, along with a small pocket clip. The second variation, used by ISB Agent Kallus, Lieutenant Yogar Lyste, and Grand Admiral Thrawn, was structurally very similar but had a bulbous activator tip in red or blue and a unique clip with inward-facing protrusions near its base. The third style, which General Cassio Tagge and Chief Moradmin Bast possessed, was structurally identical to the first, except it lacked any colored tip. It is important to note that the first and third types also had clips of different colors, specifically gold and silver. The fourth type, known as the Crewman Code Cylinder, was utilized by Admiral Conan Antonio Motti. This version was somewhat thicker, lacked a pocket clip, and had a spiral drill bulb at the top; it was also used by Imperial Pilots.

Following the example of the Galactic Empire, the First Order adopted the use of code cylinders, which they referred to as "rank cylinders" or "access cylinders." Mirroring the Empire's practice, these cylinders controlled access to command systems and specific areas within First Order vessels and installations. The officers carried their cylinders in loops attached to either side of their breastbone, rather than in pockets. First Order lieutenants Dopheld Mitaka and Rodinon both carried access cylinders; however, non-commissioned officers did not, nor did higher-ranking officers such as Colonels Erich S. Datoo and Kaplan, or even General Armitage Hux. Captain Tritt Opan possessed a fake code cylinder, which he used to conceal poison due to his role as Hux's personal assassin.