The Codex Astartes is the doctrine of the Space Marine Chapters, governing all aspects of Chapter organisation and battlefield tactics. For any given tactical situation, the Codex has hundreds of pages devoted to how it may be met and overcome. The wisdom of thousands of Imperial warriors has contributed to the Codex, and details on everything from unit markings to launching a full-scale planetary assault are contained within its pages.
The Codex was written and formalised after the Horus Heresy by the Primarch of the Ultramarines, Roboute Guilliman. Some Chapters, such as the Ultramarines and their successors, regard the Codex as a holy text, and follow it without question. Many other chapters also follow the Codex, though not always as strictly as the Ultramarines; these two types of chapters are collectively known as Codex Chapters. Among the Ultramarines, each battle brother must memorise whole sections of the codex, so that within a company there exists an entire record of the text.
Existing outside the Company level organisation, each chapter has an Armoury consisting of the chapter's Techmarines and tanks, a Librarium consisting of the Chapter's Librarians, a Chapter Space Marine Fleet and the Chapter Master, plus various headquarters staff and the Chapter's servitors and human serfs.
The 1st Company is the most powerful company, consisting entirely of Veteran Space Marines. In addition to having access to the Chapter's rarest and most advanced technology, the 1st Company is the only one trained in and equipped with Terminator Armour. Transport for the 1st Company includes Land Raiders and Rhinos. It may may also include Dreadnoughts, as these fallen heroes are encouraged to remain with their battle-brothers. The 1st Company rarely fights as a single unit, but instead its members are attached on an as-needed basis to other companies, lending their superior experience, skill, and equipment on campaign.[Needs Citation]
The 2nd, 3rd, 4th and 5th Companies are known as Battle Companies, as they generally form the main battle force deployed for engagements. All four Companies have the same organisation, split into 6 Tactical Squads, 2 Assault Squads and 2 Devastator Squads. Each Battle Company also includes two Dreadnoughts, and maintains their own motor pool of Rhino and Razorback transports, Land Speeders and Space Marine Bikes.
The 6th, 7th, 8th and 9th Companies are the Reserve Companies, designed as training and reserve formations, used to bolster the Battle Companies in combat when needed.
The 6th and 7th Companies are each comprised entirely of Tactical Squads, and in battle are used to bolster the main battle line, as well as carry out flanking or diversionary attacks. Like Battle Companies, the 6th and 7th include Rhino and Razorback transports, as well as Dreadnoughts. The 6th Company, however, is trained with and equipped to deploy entirely as bike squadrons, while the 7th can do the same on Land Speeders. These forces are held in reserve to be deployed at the discretion of force commanders as tactical situations evolve, often to bolster weak points or aid in breaking through enemy lines at specific locations.[Needs Citation]
The 9th Company, meanwhile, is comprised entirely of Devastator Squads and is used as a long-range fire support formation to anchor defensive points. Both the 8th and 9th Companies include Dreadnoughts, Rhinos and Razorbacks, though only the 8th Company is equipped with bikes and Land Speeders.
The 10th Company consists entirely of Scout Squads and has no formal size structure, as recruitment does not provide a steady flow of new recruits. As such the 10th Company is the most lightly armed and is most often used as a recon force. Scouts are sometimes mounted on Space Marine Bikes, but do not use Rhino or Razorback transports.
Each Chapter has its own unique colour scheme and Chapter Badge; however, Codex Chapters all follow a common heraldry system, though there are many slight variations from the system below.
Each Company has a unique colour that its members wear, commonly on the shoulder plate rims, but some chapters use chest eagles, bolter cases, knee pads, helmets or other parts of a Space Marine's Power Armour[Needs Citation]:
- 1st Company: White or Silver (members of the 1st Company should also paint their helmet the company colour).
- 2nd Company: Yellow or Gold
- 3rd Company: Red
- 4th Company: Green
- 5th Company: Black
- 6th Company: Orange
- 7th Company: Purple
- 8th Company: Grey
- 9th Company: Blue
- 10th Company: Nominally white, however the company colour is not displayed on their armour, because of their need to blend with their surroundings on reconnaissance missions.
The left shoulder plate of a Space Marine in Power Armour always shows the Marine's Chapter Badge. The right pad shows the squad badge, this shows the type of squad the marine belongs to and the number of his squad. Veteran Squads use a stylised version of the Crux Terminatus similar to a Cross Pattée, Tactical Squads use an arrow, Assault Squads use four perpendicular arrows pointing outwards and Devastator Squads use an inverted V. Space Marines in Terminator Armour wear the Crux Terminatus on their left pad, and their Chapter Badge on their right pad.[Needs Citation]
Officers and Specialists
- Captains wear the heraldry of their company, sometimes embellished with their own personal heraldry
- Librarians wear blue armour, irrespective of what chapter they belong to, and wear their Chapter Badge as normal. (This practice is now widely ignored, even among the more standard chapters.)
- Chaplains wear black armour, irrespective of what chapter they belong to, and wear their Chapter Badge as normal.
- Techmarines wear red armour, irrespective of what chapter they belong to, and wear their Chapter Badge as normal.
- Apothecaries wear white armour, irrespective of what chapter they belong to, and wear their Chapter Badge as normal.
- Sergeants wear the same heraldry as their squad, but carry the squad's banner, which displays the Chapter Badge and the squad's number, plus a red skull (the symbol of a sergeant). Sergeants often paint their helmets red, or in some cases wear a red skull on their helmet instead.
- Veteran Sergeants wear the same heraldry as their squad, but carry the squad's banner, which displays the Chapter Badge and the squad's number, plus a red skull (the symbol of a sergeant). Veteran Sergeants often paint their helmets red and add an additional white stripe or laurel wreath.
- Terminators: veteran battle-brothers who make use of the Tactical Dreadnought Armour.
Known passages of the Codex Astartes:
- "For our enemies will bring us to battle on the caprice of chance. The alien and the renegade are the vagaries of the galaxy incarnate. What can we truly know or would want to of their ways or motivations? They are to us as the rabid wolf at the closed door that knows not even its own mind. Be that door. Be the simplicity of the steadfast and unchanging: the barrier between what is known and the unknowable. Let the Imperium of Man realise its manifold destiny within while without its mindless foes dash themselves against the constancy of our adamantium. In such uniformity of practice and purpose lies the perpetuity of mankind." - Codicil CC-LXXX-IV.ii: The Coda of Balthus Dardanus, 17th Lord of Macragge, entitled Staunch Supremacies 
- "Gather your wits, as the traveller gauges the depth of the river crossing with the fallen branch, before wading into waters wary." - Codicil MX-VII-IX.i: The Wisdoms of Hera
- "If you know both yourself and your enemy, you can win a hundred battles without a single loss. The clever combatant imposes his will on the enemy, but does not allow the enemy's will to be imposed on him."
- "With combat knife, boltgun, and grenade, the Space Marine shall assail his foe. The chainsword is the will of the Space Marine made manifest. The Space Marine shall master all weapons, and all battlefields. When harried, the Space Marine shall drive his enemies back. The Space Marine will never know defeat." 
- "The Tactical Squad shall draw the enemy's fire, thus allowing the Devastator Squad to attack from a position of strength." 
- 1: Games Workshop Website - Ultramarines Background
- 2: The Long Games at Carcharias (Short Story)
- 3: The Chapter's Due (Novel) by Graham McNeill, Chapter Six, pg. 78
- 4: Warhammer 40,000: Dawn of War II - Chaos Rising
- 5: Index Astartes I, Codex Astartes, pgs. 12-16
- 6: Codex: Space Marines (5th Edition), [Needs Citation]