A 23-year-old man was found guilty of threatening behaviour on Friday after throwing at least five eggs at King Charles in November when the monarch visited York in northern England, prosecutors said.
The Crown Prosecution Service (CPS) said Patrick Thelwell was sentenced to a 12-month community order with "100 hours of unpaid work" following his conviction after a trial at York Magistrates' Court.
"Thelwell showed no remorse after his arrest and continued to reinforce his intent to hit HM (His Majesty) the King with the eggs," said Nick Price, head of the CPS special crime and counter-terrorism division. "This threatening behaviour is unacceptable and will not be tolerated."
Last year, footage on social media showed eggs flying past the British monarch and his wife and smashing on the ground as they arrived for a traditional ceremony in York.
The CPS said while Thelwell was waiting for the arrival of the police van he was asked by a member of the public whether he threw "something", to which Thelwell replied: "I threw eggs at him because that is what he deserves."
King Charles, who ascended to the throne in September after the death of his mother Queen Elizabeth, will be crowned at the coronation ceremony at Westminster Abbey in London on May 6.