Their plight and the massive, dangerous three-day-long operation to free them gripped the world's attention.
The group was cut off on 23 June after heavy rains flooded their way back out.
They were found by British divers last week, huddled in darkness on a ledge amid fears they could be forced to stay there for months until water receded.
There were cheers as a daring rescue operation involving dozens of divers and hundreds of other rescue workers came to an end on Tuesday evening.
In an indication of how dangerous the journey out was, a former Thai navy diver died in the caves on Friday. Saman Gunan was returning from a mission to provide the group with air tanks when he ran out of oxygen.
Aged between about 11 and 17, the members of the Wild Boars football team had entered the Tham Luang cave system in the province of Chiang Rai during an excursion with their coach.
Confirming the completion of the rescue operation, the Thai Navy Seals Facebook page announced: "All 12 Wild Boars and coach have been extracted from the cave. All are safe."
And at the house just below the mountains where the men who run the Wild Boars meet, there was laughter, shouts and cheers - and people shook hands in a very un-Thai way, says the BBC Jonathan Head.