A codicil is an amendment to a will. It modifies specific provisions — swapping an executor, adjusting a gift, adding a beneficiary — while leaving the rest of the original document intact. To be valid it generally has to be executed with the same formalities as the will itself, which means witnessing and, depending on the state, notarization.
Codicils are a holdover from when wills were retyped by hand and amending a page was cheaper than reproducing the document. That economic logic has largely disappeared. When a will lives in a system that can regenerate it, producing a clean restated will is usually simpler than layering an amendment on top of an older document.
The reason to prefer a restated will is interpretive. A will plus two codicils is three documents that have to be read together, and any tension between them becomes an argument. If a codicil changes a bequest that the original will mentions in more than one place, or if a later codicil partially contradicts an earlier one, the resulting ambiguity is exactly the kind of thing that produces a contest.
Codicils still have a place for a genuinely narrow change to a will that is otherwise correct and was drafted by an attorney whose work you do not want to disturb. But for most people, most of the time, replacing the document is cleaner than amending it.