JUST before it opens each afternoon, elderly residents gather outside one of Tokyo's last remaining old-style bath houses carrying flannels, soap and shampoo for their regular soak.

With its communal naked tubs, bright mural of Mount Fuji and sliding wooden entrance under a pointed roof, Inariyu is a classic example of a Japanese public bath, or sento.

Once ubiquitous in crowded urban areas, sentos are now closing quickly as more people take baths at home and owners struggle with faltering machinery, high gas prices and a lack of successors, tempting them to sell their valuable land.

Nationwide, the number of bath houses has plunged to around 1,800 from a peak of nearly 18,000 in the late 1960s.

But some such as Inariyu have been given a new lease on life through renovations, while others are reinventing themselves as trendy hangouts or using data analysis to boost business.

One person pushing to save neighbourhood baths is Yasuko Okuno, who discovered them as a way to unwind after working late.

"Day after day, my mind was tired. Even when I went home, I couldn't forget about work," said the 36-year-old writer for the Tokyo Sento Association.

"Then I went to a sento for the first time in a while, and it felt like a weight had lifted. There was a large bath, and the regulars greeted me kindly," she told AFP.

Over time, "it began to feel like a home from home."

Japan has never imposed a strict COVID-19 lockdown, and places such as gyms and sentos remained open even when many offices switched to home working and restaurants shortened opening hours.

Masks are commonly worn on trains and in other public places, but there is no requirement to wear them in sentos, although social distancing and quiet bathing are encouraged.

For many elderly people, it is a "daily routine" that they did not want to stop during the pandemic, and some feel safer taking a bath with others around in case they fall, Yasuko said.

- 'Sense of urgency' -

Bathhouse closures can erode community ties, said Sam Holden, whose organisation Sento & Neighborhood used a grant of around $200,000 from the World Monuments Fund to renovate Inariyu.

The group strived to keep the cosy, welcoming atmosphere of the bathhouse -- built in 1930 in a low-rise area of northern Tokyo where narrow walkways snake between homes.

Inariyu has customers of all ages, including "a lot of elderly people, many of whom might live alone and be prone to isolation", said Holden, a 32-year-old American who has lived in the capital for nearly a decade.

"My colleagues and I had a sense of urgency in wanting to preserve some of these historic structures before they were redeveloped into apartment complexes and other things."

Bathers pay 500 yen ($3.70) to enter the men's or women's bath, a fee set by the Tokyo government.

Leaving their shoes in a small locker, they strip off in the changing room and take a shower before climbing into the tubs for a relaxing soak.

Unlike Japan's hot springs, known as onsen, the water in sentos is usually heated with gas.

Shunji Tsuchimoto, who runs Inariyu with his wife, told AFP that the bathhouse is paying 50 percent more for energy than it did last year.

But he hopes that holding events in the renovated buildings will raise revenue by drawing younger customers.

"I want them to know this sento culture," he said.

- 'Trendy and modern' -

One sento that has managed to draw a youthful clientele is Koganeyu in eastern Tokyo, which reopened in 2020 after a full makeover.

On a recent Saturday, the bath house was packed with young customers drinking craft beer and listening to vinyl records.

Tech worker Kohei Ueda, 25, travelled an hour to use Koganeyu's sauna with a friend.

"I do have the image of sentos being where grandpas and grandmas gather," he said.

"But a sento like this that's more trendy and modern is not like that... I feel more comfortable coming here."

Kom-pal, another sento, may not have hipster appeal, but 36-year-old owner Fumitaka Kadoya has managed to increase footfall using data-crunching skills he acquired in his previous job as a technician for optical equipment maker Olympus.

Kadoya's family has run the sento since the 1950s and when he took over three years ago, he set up a database to track information about customers and the timing of their visits.

The data has allowed him to make targeted business decisions, such as hiring female staff to encourage more women to visit and opening on Sunday mornings to ease crowds.

"Sentos have always been a part of Japanese culture," Kadoya told AFP, and nowadays, leaving everything in a locker while you soak can be a kind of "digital detox".

"That's exactly what I think young people need these days."