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.
In the aftermath of the Horus Heresy, the Emperor had been incapacitated, and the Space Marines' numbers had been decimated by defections to Chaos and battle losses. With the Emperor confined to the Golden Throne the High Lords of Terra found themselves the new leaders of the Emperor's domain. Both the High Lords and surviving Primarchs became paranoid of the possibility of such events repeating themselves. The armies of the Emperor once again scoured the galaxy seeking out all forms of heresy and removing even the slightest chance of rebellion. The Ultramarines were left as the largest loyal legion, and Guilliman assumed the title of Lord Commander of the Imperium.[Needs Citation] Concerned that once again their could be a threat from such a terrible force each Legion was to be divided into smaller Chapters and a new set of regulations would be created to govern them.
The Codex Astartes was a code developed by Guilliman. This tome would contain everything a member of the Astartes would need to know to function. From recruitment to organization to tactics and beyond the Codex Astartes became a sacred text to the majority of the Chapters. One of the most significant changes under the new Codex was the newly founded Chapters. Where the Legions could number more than 10,000 strong the Chapters would be limited to about a thousand. Each original Legion would be divided as many times as needed into successor Chapters. This division would come to be called the Second Founding seven years after the Horus Heresy, in 021.M31. The remaining thousand bodies in the original Legion would also survive as a new Chapter of the same name. While these newly created Chapters claimed their founders origins, such as their Primarch, they would also come to develop their own culture and customs.
Rogal Dorn initially rejected the Codex Astartes and enmity developed between him and Guilliman. Dorn called Guilliman a coward, citing his lack of participation in the defense of the Imperial Palace. Guilliman accused Dorn of being a traitor for refusing the Codex. This enmity quickly involved other Space Marine Legions and a rift developed, Leman Russ of the Space Wolves stood by the Imperial Fists, while Jaghatai Khan of the White Scars and Corax of the Raven Guard supported the Ultramarines. A second civil war appeared likely when the Imperial Fists strike cruiser Terrible Angel was fired upon by the Imperial Navy in connection with Codex crisis.
However, Dorn ultimately relented after spending seven days meditating in the pain glove. There, he concluded that the Legion could no longer serve the Emperor who had been and must serve the Emperor who was, which involved accepting the new order of which the Codex was a part. The Space Wolves Legion, however, never fully accepted the new doctrine. Rather they held sacred the teachings of their Primarch. One of the few ideals the Codex implemented that the Space Wolves Legion actually followed was the succession of Chapters. However, the Space Wolves Legion was never very large. That combined with the genetic instability of the legion gene-seed lead to the Legion only founding one successor Chapter, the ill-fated Wolfbrothers.
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, Stormraven's, 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), pg. 16
- 7: Codex: Black Templars (4th Edition), pg. 6
- 8: Index Astartes II: Imperial Fists, pgs. 14-15
- 9: Codex: Space Wolves (5th Edition). pgs. 8-9
- 10: Grey Hunter (Novel) by William King, [Needs Citation]
- 11: Deathwatch: Rites of Battle, pg 53