The 34 year-old announced his intentions at a press conference in Nice on Tuesday, a day ahead of a key Group E game against Belgium.
He said, according to the Swedish federation's website: "Sweden's last game at the European Championship will be my last match for Sweden. I hope it will not be tomorrow."
Ibrahimovic, who left Paris St Germain at the end of last season, has been linked with a move to Manchester United as he looks to extend his club career.
He had been included in a provisional Sweden squad for the Olympic football tournament but has ruled out playing in Rio.
The Olympics coincides with the start of major domestic football seasons in Europe.
Ibrahimovic said: "I will not participate in the Olympics.
"I want to thank all the supporters who have helped me to achieve what I have done. Wherever I go, I will always take with me the Swedish flag and be proud of it. I will never be disappointed. So thanks to all."