According to the Ritsuryo codes, 薨 should be written if the person is ranked as third grade or higher, 卒 should be written if they are ranked as fourth or fifth grade, and if they are ranked as sixth or lower, it should be written as 死.
律令には、三位以上は薨、四位と五位は卒、六位以下は死と表記することとなっている。