The boys are seen by torchlight sitting on a ledge above water, responding to the divers that all 13 were there and that they were very hungry.
They ask how long they have been underground and whether they can leave now. The divers tell them they have to wait, but say people will come back for them.
One boy replies: "Oh. See you tomorrow."
The search for the group had gripped the nation as it was unclear where they were or whether they even were still alive.
Families of the missing group were ecstatic at news of the rescue.
How did they get there?
The boys, aged between 11 and 16, and their 25-year-old coach went missing on 23 June. It's believed they entered the cave when it was dry and sudden heavy rains blocked the exit.
They were found on a rock shelf around 4km (2.5 miles) from the mouth of the cave.
It is thought the boys could move through parts of the cave in dry conditions but rushing waters clogged the narrow passages with mud and debris, blocking visibility and access.
One of the toughest stretches for the divers came as they neared so-called Pattaya Beach - an elevated mound in the cave complex - where it was hoped the boys had sought refuge.
Divers had to navigate a series of sharp, narrow bends in near-darkness. They completed the difficult journey to find Pattaya Beach flooded, so swam on and found the boys about 400m away.
How can they get out?
Bringing the trapped boys to safety is an extremely dangerous task given the conditions inside.
The Tham Luang cave complex in Chiang Rai in northern Thailand is regularly flooded during the rainy season which lasts until September or October.
If the children are to be brought out before then, they will have to learn basic diving skills.
But experts have cautioned that taking inexperienced divers through the dangerous corridors of muddy, zero-visibility waters would be very risky.
Attempts to pump the water levels lower have so far not been successful.
If they are to wait until the water recedes by itself, it would mean the boys will have to stay in the cave for months and have to be continuously supplied with food and assistance.
Specially trained doctors will go in to carry out medical checks in the coming days to establish their condition and treat possible injuries.
BBC South East Asia correspondent Jonathan Head, who is at the scene, said the Thai military has a few doctors with the diving skills required to reach them.
"But even when they recover their strength, pulling them back through miles of partly flooded tunnels will be a daunting challenge. And the rainy season has just started here - water levels will rise," he said.
Other teams are still scouring the mountainside in the hope of finding another way in to the cave.
Who are they?
The 12 boys are all members of a local football team and their coach is known to have taken them on occasional excursions and field trips.
Tinnakorn Boonpiem, whose 12-year-old son Mongkol is among the 13, told AFP news agency near the caves she was "so glad" to hear they were safe.
"I want him to be physically and mentally fit," she said.
"I'm so happy I can't put it into words," another relative of one of one of the group told reporters as tears of joy streamed down his cheeks.