A codicil is a legal document that modifies, explains, or revokes a will or part of a will without the need to rewrite the entire will. It must be executed with the same formalities as a will, including the signatures of the testator and witnesses, to be legally valid.