The 18-year-old high school student from Medan on the island of Sumatra, identified by the initials MFB, was found guilty of violating the country's internet law by making defamatory and slanderous comments online.
Judges also ordered him to pay 10 million rupiah ($700) in fines.
"If the fines are not paid, the jail term is extended by one month," the presiding judge told the Medan court.
The teenager accepted the verdict and did not file an appeal.
MFB was arrested in August last year after he posted numerous inflammatory messages and memes against Widodo and police chief Tito Karnavian using fake accounts.
Also Read
The government of Indonesia, the world's largest Muslim majority country, has received criticism following a string of arrests of people accused of insulting the president, making slanderous comments and posting fake information on social media.
Democracy and rights activisits have branded the internet law draconian and a threat to free speech.
Last week a court in Jambi province, also on Sumatra, sentenced a local politician to one year in jail after he made a Facebook post considered to be insulting Islam. The judges found him guilty of violating the law and "inciting hatred".
Disclaimer: No Business Standard Journalist was involved in creation of this content