The leftist Syriza government's surprise decision to call that vote scuppered its bailout talks with eurozone ministers.
The Greeks have very little time to prepare for a referendum whose outcome could decide their future in the euro.
What is the point of the referendum?
The government says the EU-IMF bailout terms are unacceptable, but cannot simply be rejected without the Greek people having their say.
The issue is so important for Greece's future that "we decided to turn to the citizens, to explain our negative attitude to it [the bailout], but to give them the choice", Finance Minister Yanis Varoufakis said.
Prime Minister Alexis Tsipras, in a letter to eurozone leaders leaked by the Financial Times, said holding a referendum "is a sovereign democratic right of the Greek people, necessary to ensure ownership over the financial assistance programme that will be eventually agreed with the institutions".
He told the Greek people that the lenders had resorted to "blackmail" in order to impose more austerity.
After five years of recession and welfare cuts many ordinary Greeks feel bitter that they have suffered while Europe's business elite recovered quickly from the financial crisis.
More than democracy is at stake - a vote to reject the bailout could trigger a "Grexit", a Greek exit from the euro.
A No vote would formally cut the euro pipeline from lenders, and the Greek government could be forced to issue IOUs or a "new drachma" currency to prevent a banking collapse.
However, the EU has no mechanism for a country to leave the euro - it has never happened before.
What will the question be?
The language is quite technical, and many Greeks may struggle to understand it:
"Should the proposed agreement be accepted, which was submitted by the European Commission, the European Central Bank, and the International Monetary Fund in the Eurogroup of 25.06.2015 and consists of two parts, which constitute their unified proposal?
"The first document is entitled 'Reforms for the Completion of the Current Program and Beyond' and the second 'Preliminary Debt Sustainability Analysis'."
Beside the question are two boxes: "Not approved/No; Approved/Yes".
Uncertainty still surrounds the referendum. Mr Tsipras's political opponents say he has not told the Greek public exactly what the lenders were proposing, and what in particular he rejected.
It is not impossible that Greece's tortuous negotiations with lenders could resume in the coming days.
And the current bailout expires on Tuesday - the day that Greece is supposed to pay back €1.6bn (£1.1bn; $1.8bn) to the International Monetary Fund.
Greece is teetering on the brink of default, and if that happens events could unfold dramatically before 5 July.
Who wants a No vote in the referendum?
Syriza, the nationalist Independent Greeks, and far-right Golden Dawn say "No" to the bailout terms.
Opposition parties object to holding a referendum, and their supporters are likely to vote "Yes" or abstain.
The main opposition parties are New Democracy (centre-right), To Potami (centrist) and Pasok (centre-left).
What was the lenders' reaction?
Anger. Eurozone finance ministers had been preparing for last-ditch talks on 27 June to hammer out a deal on reforms. Agreement would mean releasing the final €7.2bn bailout instalment that Greece desperately needs.
But Mr Tsipras pulled his delegates out of talks the night before and announced the referendum.
In an unusual move, the European Commission later published the detailed reforms that it wanted to negotiate with Greece.
But the Commission complained that "neither this latest version of the document, nor an outline of a comprehensive deal could be formally finalised and presented to the Eurogroup due to the unilateral decision of the Greek authorities to abandon the process".
Commission President Jean-Claude Juncker said he felt betrayed by Mr Tsipras's move. "Playing off one democracy against 18 others is not an attitude which is fitting for the great Greek nation," he said.
IMF chief Christine Lagarde said any referendum would relate to "proposals and arrangements which are no longer valid".
Lenders' proposals - key sticking points
Source: European Commission document, 26 Jun 15 (pdf)
Why couldn't Greece get a bailout extension?
There remains a big gap between what the lenders want and the Greek government's agenda.
Syriza - a grassroots coalition of leftists - won elections in January promising to end austerity.
The price for Greece's massive €240bn bailout, which started in 2010, was austerity. The budget cuts demanded by the lenders have thrown many Greeks into hardship and a quarter of the workforce is unemployed.
Syriza has urged the lenders to release the last €7.2bn of bailout money. But the lenders say Greece must agree to widen the scope of its sales tax (VAT) - to boost revenue - and drastically reduce the numbers entitled to early retirement. The pension system is unsustainable, they argue.
Those are the main sticking points, but the lenders also want much more action against corruption and tax evasion.
The lenders are not convinced by Syriza's tax income projections. They also suspect that Syriza is unwilling to reform deeply-entrenched working practices.
Greece's cash-strapped banks are to remain shut for a week, until after a key 5 July referendum on the country's bailout conditions.