THE Tham Luang cave has delivered its miracle, with all 13 members of the Wild Boar soccer team making it to safety in one of the most inspiring rescue missions the world has witnessed.

The Royal Thai Navy SEALS have confirmed all 12 boys and their coach have successfully swum through flooded passages and are now either out of the cave system.

The Navy SEALs and Australian anaesthetist, Richard Harris, have also emerged from the caves.

The 18-day ordeal, which at times teetered between grief and elation, has ended in extraordinary success, with Thailand celebrating and thanking the world for its prayers and assistance.

"We are all delighted," said Governor Narongsak Osotthanakorn, hours after the team - and the SEALs - emerged securely.

"We have done things we never thought we could do. I'm proud we could complete the mission impossible."

The Thai Navy SEALs posted on their Facebook page: "We are not sure if this is a miracle, a science, or what. All the 13 Wild Boars are now out of the cave. Everyone is safe".

It comes FIFA reiterated their invitation for the team to attend this Sunday's soccer World Cup final, and famous clubs like England's Manchester United sent messages of congratulations.

"Our thoughts and prayers are with those affected. We would love to welcome the team from Wild Boars Football Club and their rescuers to Old Trafford this coming season."

Manchester United is very popular in Thailand, with 135,000 "friends" on the local fan club's Facebook page.

The final boy emerged into daylight on Tuesday about 6pm local time (9pm AEST).

Nineteen divers helped escort the final five members of the group out of Tham Luang cave, in the toughest rescue operation of the past few days.

The youngest of the group, aged just 11, was one of the last to reach the surface.

The four boys rescued on Tuesday have now been transported by ambulance and helicopter to a hospital in Chiang Rai province in northern Thailand, where they will join their teammates.

The coach has also left the cave, with a doctor and four Thai Navy SEALs following behind.

The 11th boy came to the surface at 5.15pm local time (8.15pm AEST), the 10th about 4.30pm local time (7.30pm AEST) and the ninth just minutes earlier at 4.06pm.

The first four boys emerged on Sunday, followed by another four on Monday.

The Australian's Amanda Hodge has reported that Adelaide anaesthetist Richard Harris has continued to play a central role in the rescue, diving each day all the way to where the boys were trapped to check their condition before clearing them to dive.

"He only leaves the cave when the last boy is rescued each day," she said.

It's an extraordinary end to a mission many said was impossible.

Rescuers saved a group of children trapped almost four kilometres underground and taught them to dive their way out of flooded caves and tunnels.

The constant threat of rain meant the situation in the Tham Luang Nang Non cave system could have got far worse.

And yet, the impossible was achieved.

How the boys will find freedom.
How the boys will find freedom.

There must have been dark times when the 12 members of the Wild Boars soccer team, holed up in the dank and pitch black surroundings of the caves, wondered if they would ever be found.

Or if the steadily rising waters would slowly, but ever so surely, engulf them all.

Yet, 17 days after they first entered the notorious natural tunnel system in northern Thailand, after battling loneliness, cold and the intimidating task of learning how to dive, the outcome no one dared to dream of has become reality - all the boys and their coach are back out in the open, seemingly only slightly worse for wear given their ordeal.

Earlier on Tuesday, the SEALs posted a message that said: "Tonight, all the Wild Boars will be reunited."

Mission commander and Governor of Chiang Rai province Narongsak Osottanakorn said: "We expect that everybody will be out today, the children and coach and everybody will be out today."

However, Mr Narongsak sounded a note of caution, telling reporters that the third mission was more perilous than the previous two. Not four, but nine people needed to make it out this time: four boys, the coach, a doctor and three Navy SEALs.

The death of military diver Saman Kunan on Friday only underscored the huge risks the boys faced.

But out they came, one by one. At 4.06pm local time (7.06pm AEST) the ninth boy emerged, followed around half an hour later by the tenth and then at 5.15pm by the 11th. The 12th emerged later. The team's coach came last.

Aged between 11 and 16, the BBC has named the people trapped in the caves as:

- Chain Vibulrungruang (known as Titan), 11

- Panamas Sangdee (known as Mig) 13

- Duganpet Promtep (known as Dom), 13

- Adul Sam-on, 14

- Somepong Jaiwong (known as Pong), 13

- Mongkol Booneiam (known as Mark), 14

- Nattawut Takamrong (known as Tern), 14

- Peerapat Sompiangjai (known as Night), 17

- Ekarat Wongsukchan (known as Bew), 14

- Prajak Sutham (known as Note), 15

- Pipat Pho (known as Nick), 15

- Pornchai Kamluang (known as Tee), 16

- Assistant coach Ekapol Chantawong (known as Akeake), 25