The attack in June claimed the lives of 38 holidaymakers, including 33 of Tui customers. All of the 30 Britons who died were travelling with the group, owner of the Thomson and First Choice brands.
Tourists were flown home from the North African country and the travel operator has cancelled holidays there, with the UK Foreign Office among governments still advising against visits.
The cost of the flights home was €10 million (£7m), while the impact of empty hotels in a region that normally accounts for just under half a million Tui visitors a year is expected at €25m to €30m. Together with other costs, the total impact is seen at €35m to €45m, a spokeswoman for the company said.
Tunisia has in the past represented 3 per cent of the company’s annual tour operator programmes.
Tui set out details of the impact in a trading update for the third quarter to the end of June.
Joint chief executives Friedrich Joussen and Peter Long said: “This quarter was marked by the tragic events in Tunisia at the end of June.
“Supporting our customers, their families and our colleagues through this sad time remains our highest priority. We are very proud of the commitment and dedication our colleagues have shown throughout this unprecedented situation.”
Long described the attack as a “human tragedy that completely overshadowed our quarter”. He said it was “the most horrific event I and my company have ever had to deal with”.
Tui also said that bookings to Greece in late June and the first half of July were hit by economic uncertainty in the region, but recent weeks have seen an improvement in bookings, which remain ahead of last year.
The figures come after rival Thomas Cook revealed a £25m hit to earnings from events in Tunisia and Greece.
Long said that after the Tunisia attack, 18 additional flights were laid on to bring holidaymakers home, including 13 from the UK, four from Belgium and one from the Netherlands.
Long said: “Our priority has been to support our customers, their families and colleagues impacted by this horrendous event.
“Both I and all my colleagues still remain in deep shock as a result of the tragic loss of life and injuries to our customers.”
Despite the tragedy, Tui delivered an 18 per cent rise in underlying earnings for the third quarter to €194m. Long said summer trading remained “robust” while bookings for the winter were in line with expectations and there had been a good start for the summer 2016 period.
Shore Capital analyst Greg Johnson said: “Overall, we see this as a robust statement from Tui, when set against the geopolitical events in the period. Full-year guidance has been maintained, highlighting the flexibility in the business model.”