Yahye Omar Mohamed, 14, and Waseem Muflahi, 15, both from Birmingham, were on a trip to Barmouth, Gwynedd, on 7 August when they died.
A friend said they had been warned before they ventured into deeper water.
A conclusion of accidental death was recorded at Wednesday's inquest in Caernarfon.
Coroner Dewi Pritchard Jones said: "This is a classic situation of healthy active boys swimming in the sea, but not realising the dangers if they get caught in surf with strong undertow.
"I don't believe I can do anything to prevent further fatalities other than to warn people that there is no such thing as a safe beach, though the risks in Barmouth are no greater than anywhere else."
Mahdi Farah, a friend of the two boys who was rescued from the water, said the boys had been enjoying the water at a safe depth, but went out further than they should have.
"I went to give them a stern telling off," he said.
"But the strong waves were crashing down and they dragged us out. I was telling the boys to stay calm and battling to keep them upright.
"But every time I tried to swim to shore with them, the current kept dragging us back."
Harbourmaster Anthony Glyn told the hearing: "I saw three people in the water, scattered 50-100 metres apart, so I told two of my colleagues, beach wardens, to take a throw line and go into the water a small way to try and rescue the closest of the three.
"As soon as they did, another wave came and took my colleagues out too.
"They managed to get the throw line to Mahdi Farah and I called for urgent help from the coastguard and lifeboat.
"Then I saw one of the boys go under the water. As the lifeboat reached the line of the surf, the second boy disappeared."
The bodies of the boys were recovered on beaches north of Barmouth a few days later.
Two teenage boys who drowned while swimming in the sea disappeared beneath the waves minutes before a lifeboat could reach them, an inquest has heard.