A codex (Latin for book) is a handwritten book from late Antiquity or the Middle Ages. Although the Romans used the codex and similar precursors made of wood for taking notes and other informal writings, the first recorded use of the codex for literary works dates to Martial in the late 1st century A.D., who experimented with the medium. At that time, the roll (also called a scroll) was the dominant medium for literary works and would remain dominant for secular works until the 4th century A.D. As far back as there is evidence in the early 2nd century A.D., it appears that the codex was the preferred format for Christian writings.
The correct Latin plural is codices, although codexes is also often used as a plural form in English. The codex was an improvement over the scroll, because its pages and spine allow easier reading, and pages can be written on both sides. Though early codices were made with papyrus, medieval book makers used parchment or vellum for their pages, which made them very durable, but extremely expensive. The scholarly study of manuscripts from the point of view of book-making is called codicology.
The books of Pre-Columbian Mesoamerica had basically the same form, with long folded strips of paper (usually made from either wood bark or plant fibers, often with a layer of whitewash applied before writing), hence the ancient books of the Maya, Aztec, and Mixtec peoples, among others, are also known as codices.
A legal text or code of conduct is sometimes called a codex (for example, the Justinian Codex), since laws were recorded in large codices.
Among players of the game Warhammer 40,000, a source book for a particular side is called a Codex.