The men were able to leave the Hölloch overnight on Thursday after the water level began to drop, according to the canton of Schwyz police.
In a Facebook post the police said the cavers had left by the route they had used to enter the cave accompanied by a special assistance team.
The men were freed in an operation lasting several hours, the Swiss news agency SDA reported.
Following a medical examination all eight returned to their homes.
The amateur cavers aged 25 to 55 set off on Saturday with an experienced guide for a two-day bivouac excursion inside the cave network near Lucerne, one of the largest caves in the world.
When the water level in the cave rose they became trapped and were unable to leave as planned on Sunday.
A rescue team located the cavers after several hours but was unable to free them.
At a news conference on Monday the cave rescue service Speleo-Secours Schweiz said it could take up to a week to free the men.
The bivouac was equipped with a kitchen, sofas and beds and the men were offered psychological support as they waited to be freed.
Most caving expeditions take place in winter when the water level is low, and it is not unusual for cavers to become trapped.
The Blick newspaper quoted a police spokesperson as saying there was no indication of negligence on the part of the organizers, and no criminal investigation would be launched.