The Supreme Court has said the mandatory death sentence is unconstitutional.
Section 204 of the penal code states that any person found guilty of murder, robbery with violence, treason and other capital offences shall be sentenced to death by hanging.
But Justice Njoki Ndung'u said the section "is out of sync and cannot stand as it is inconsistent with the constitution".
The court made the landmark ruling on Thursday after a petition by two death row convicts Francis Murwatetu and Wilson Thrombus.
It sent the petitioners back to the High Court for another hearing on sentence on priority basis.
The apex court judges further directed the Attorney General, the Director of Public Prosecution and other agencies to prepare a detailed professional review of cases regarding sentencing.
They ordered that the judgement be placed before the National Assembly speaker for necessary amendments to the law.
The Supreme Court also ruled that any court dealing with capital offences should be allowed to use judicial discretion when delivering judgements.
Although death sentences are frequently handed down, the last time a convict was hanged was July 1987, when Kenya Air Force senior private Hezekiah Ochuka was hanged for the 1982 coup attempt.
More on this: No hanging since 1987: Is death penalty still relevant?
On July 30, the Court of Appeal unanimously held that mandatory death sentences are unconstitutional as they violate the right to life and inflicts inhuman punishment.
It also said that holding a person on death row for more than three years is unconstitutional.
The mandatory death penalty was generally bequeathed on all former British colonies, as stated under the Common Law of England, as the “penalty of murder”.
In October last year, President Uhuru Kenyatta commuted 2,747 death row convicts to life imprisonment.
But Uhuru once called for the death penalty on persons found vandalising SGR property, which resulted in sharp responses from Kenyans.
Story updated to reflect that the ruling is on the mandatory death sentence.