The judge also fined him 1m shekels ($289,000; Â£171,000) and ordered that 560,000 shekels in assets be seized.
Olmert's lawyers said he was innocent and would appeal. If he is unsuccessful he will become the first former head of government in Israel to be jailed.
The 68-year-old was convicted in March over a real estate deal that took place while he served as mayor of Jerusalem.
The Tel Aviv District Court found he had accepted a 500,000-shekel ($145,000; Â£86,000) bribe from the developers of a controversial apartment complex, known as Holyland, for which planning and zoning laws were changed, and another 60,000 shekels for a separate project.
By Yolande KnellBBC News, Jerusalem
This jail sentence is a dramatic fall from grace for a man who was once one of the most powerful figures in Israel.
It is also likely to end any hopes of a political comeback for Ehud Olmert.
Recently, as he criticised the Israeli government's handling of peace talks with the Palestinians, it seemed he still held ambitions to return to public life.
However, the judge in this case said that Olmert's crimes involved "moral turpitude", meaning he will be barred from office for seven years after serving his sentence.
In his memoirs, Olmert claims he came very close to a peace deal with the Palestinian Authority President Mahmoud Abbas in 2008.
But in his three years in office he also took Israel into two bloody, armed conflicts - the 2006 war with the militant Lebanese Shia Islamist group Hezbollah, and a three-week offensive on Gaza in 2008-2009 that left some 1,400 Palestinians and 13 Israelis dead.
Now corruption has been added to Olmert's political record. However, many Israelis hope his sentencing is a sign that their country is cleaning up its political culture.
Ten other government officials and businesspeople were convicted alongside Olmert. The sentences handed down on Tuesday against six of them ranged from three to seven years.
Judge David Rozen said bribery offences "contaminate the public sector" and "cause the structure of government to collapse".
He added: "People who receive bribes give rise to a feeling of disgust and cause the public to despise the state's institutions. The taker of bribes is like a traitor who betrays the public trust that was given to him - trust without which a proper public service cannot be maintained."
The judge said Olmert had made a "large contribution to the country".
But he described his offences as "noxious" and said he was guilty of "moral turpitude", which under Israeli law would preclude him from running for public office for seven years after finishing his jail term.
Olmert reportedly stood quietly in the courtroom with his head bowed. His lawyers had sought a non-custodial sentence.
The judge told him to report to prison on 1 September, effectively giving his lawyers time to lodge their planned appeal.
"He did not take a bribe. He did not receive a bribe. He sees himself as innocent, and it is with those feelings that he will be going to the Supreme Court to appeal," Olmert's lawyer, Eli Zohar, told reporters.
Justice Minister Tzipi Livni, who served as Olmert's deputy prime minister and foreign minister said: "It is a difficult day when a former prime minister is sentenced."
"I have complete trust in the court and law enforcement officials, and the public should as well."
Olmert served as prime minister from 2006 to 2009, until a flurry of corruption allegations led to his resignation.
He was acquitted of most of the major charges eventually brought against him by prosecutors but was also found guilty of breach of trust and given a one-year suspended jail sentence.
He was found to have made decision when he was minister of trade and industry that benefited clients of a close associate.
A court in Israel has sentenced former Prime Minister Ehud Olmert to six years in prison for bribery.