A codex (Latin for book; plural codices) 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 first century, 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. As far back as the early 2nd century, there is evidence that the codex was the preferred format for Christian writings. In the time from the 4th century, when the codex gained wide acceptance to the Carolingian Revival in the 8th century many works were not converted from scroll to codex and were lost to posterity.
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 it can be opened flat at any page, allowing easier reading, and pages can be written on both sides. The codex also made it easier to organize documents in a library because it had a stable spine on which the title of the book could be written, and later read when books where arranged upright on shelves. The spine could be used for the incipit, before the concept of a proper title was developed, during medieval times.
Medieval book makers used parchment or vellum for their pages, which made them very durable, but extremely expensive. Early codices were made also made from papyrus, however papyrus is too fragile to be repeatedly folded. The scholarly study of manuscripts from the point of view of book-making is called codicology. The study of ancient documents in general is called paleography.
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.
The codex is the songbook used at a cantus.