STOCKHOLM — If he had hopped on a plane, Johan Hilm would have gotten from Sweden to Austria in two hours.

Instead, the lanky Swede made an epic overland journey by rail, bus and ferry that took more than 30 hours.

He joined a growing crowd of Europeans who are spurning air travel out of concern for the environment this summer.

Budget airlines such as Ireland’s Ryanair and British easyJet revolutionized European travel two decades ago, when they first started offering to scoot people across the continent for as little as $20 a flight. That mode of travel, once celebrated as an opening of the world, is now being recognized for its contribution to global problems.

Tourists have been spooked by the realization that one passenger’s share of the exhaust from a single flight can cancel out a year’s worth of Earth-friendly efforts. And so they are digging out their parents’ yellowing Europe-by-rail guidebooks and trading tips on the most convenient night train to Vienna.

Mark Smith, founder of Seat 61, a popular website dedicated to train-based travel around Europe and beyond, said he has noticed a change in the people coming to his site. When he set it up in 2001, users told him they loved trains, or were scared of flying, or couldn’t fly.

“Now, when people tell me why they are taking the train, they say two things in the same breath: They say they are fed up with the stress of flying, and they want to cut their carbon footprint,” Smith said.

So far, the biggest shift has been in green-conscious Sweden, where airline executives blame increased train travel — up one-third this summer compared with a year ago — for a drop in air passenger traffic.

Swedish leaders this month announced they would inject new cash into the national rail company. They plan to build up a new fleet of trains after years of cutbacks when cheap plane tickets were luring people into the skies.

The newly coined concept of flygskam, or “flight shame,” has turned some Swedes bashful about their globe-trotting. A guerrilla campaign used Instagram to tally the planet-busting travels of top Swedish celebrities. Next door in Norway, meanwhile, the prime minister felt the need to assure citizens that they need not apologize for flying to see family in the high north.

Hilm, 31, a health-care consultant who was on his way to hike across Austria for eight days, said he tried to live an environmentally responsible life. “I don’t drive a car. I eat mostly vegetarian. I live in an apartment, not a big house.”

He was stunned when he assessed the impact of his flights. “I did one of those calculators you can do online,” he said, “and 80 percent of my emissions were from travel.”

“I don’t want to say I’ll never fly again, but I do want to be conscious about the decisions I make,” Hilm added over coffee in the Stockholm-to-Copenhagen train’s bistro car. Little kids bounced on the squishy red banquette seats nearby. In the passenger compartments, some people dozed, others played card games. Out the window, cows looked up from their fields as the train hurtled through at 120 mph.

Environmentally friendly travel can require a time investment. To get to Austria, Hilm took a 5½ -hour train trip to Copenhagen, a 1¾ -hour bus to the Danish coast, a 45-minute ferry to Germany, a 90-minute train to Hamburg, an 11-hour night train to southern Germany and a final three-hour train.

He left his Stockholm apartment before 6 a.m. on a Wednesday. He arrived at his Alpine destination after noon the next day.

What was it worth? Measuring carbon dioxide emissions from travel can be an inexact science. One popular online calculator suggested that Hilm’s trip would have led to about 577 pounds of carbon dioxide emissions if he had flown, compared with 118 pounds by rail, a savings of 80 percent.

In the first six months of 2019, air passenger traffic was down 3.8 percent in Sweden compared with the previous year. Climate concerns are among several reasons for the downturn, said Jean-Marie Skoglund, an aviation expert at the Swedish Transport Agency. He said a slowing economy, tax changes and an airline bankruptcy were other factors.

Across Europe, air travel still ticked up — by 4.4 percent — in the first quarter of 2019, according to figures from Airports Council International Europe, an industry group. But for young, green Europeans, saying no to flying is becoming a thing.

The shift has been inspired in part by Greta Thunberg, the 16-year-old Swedish climate campaigner who sparked a worldwide school strike and has been crisscrossing Europe by train as she pressures politicians to do more about the environment. Thunberg has not been on a plane since 2015. This week, she said she would soon travel to the United States — by sailboat.

Record heat this summer and last has also focused attention on climate change and influenced travel plans. Hilm set out on his trip during a heat wave that brought all-time high temperatures to Paris, Britain, Belgium, Germany and the Netherlands.

“If you want to reduce your environmental impact, the best thing you can do is to stop flying,” said Susanna Elfors, founder of a Facebook group called Tagsemester, or Train Vacation, that has been credited with helping to spur train travel. Users exchange practical tips and cheer on each other’s journeys. The Swedish-language group now has 99,000 members — which could mean that 1 percent of Sweden’s 10 million people are using it.

The aviation sector generates about 2.5 percent of global carbon dioxide emissions — meaning it’s only a small fraction of the problem. A European Union list released in April ranked Ryanair among Europe’s top 10 carbon emitters, grouping the airline with companies that operate coal-fired power plants. “Passengers travelling on Ryanair have the lowest CO2 emissions per kilometer traveled than any other airline,” the company responded in a statement.

European leaders are beginning to reconsider how much they should encourage plane travel. Jet fuel is currently untaxed in the E.U., unlike in the United States. France this month announced it would introduce an eco-tax on flights originating at French airports, with the money to be reinvested in rail networks and other environmentally friendly transport. Several other European countries have imposed or increased flight taxes. The Dutch government is lobbying for an E.U.-wide tax on aviation.

Even some airlines have gotten in on the “fly less” message. 

“Think about flying responsibly,” Dutch airline KLM said in an advertisement unveiled this month. Unusually, it suggested considering a different form of transportation: “Could you take the train instead?”

Airlines say they are taking steps to be greener. SAS, the largest airline in Scandinavia, is ending in-flight duty-free sales and asking passengers to pre-book meals so planes can be lighter and more fuel-efficient. Pilots have been urged to taxi on the ground with only one engine switched on.

Anxiety about climate change is “playing a part, for sure,” in Sweden’s dropping air passenger traffic, said SAS chief executive Rickard Gustafson. He said the airline was pushing to expand its use of renewable fuels as quickly as possible.

He said, however, the world needs air travel.

“The society that we all enjoy, the wealth and the social security that we all have — without aviation, it would all collapse,” he said.

To be sure, there are limits to train travel. It can be time-consuming, and the transit is not always painless. Travelers on the Swedish Facebook group complain of trains without air conditioning that turn into saunas and delays that cause missed connections.

Marcus Nygren and Linnea Rothin, a Swedish couple who just returned from a three-week rail trip around central Europe, said on one stretch, they were crammed into a night train compartment with a woman who spoke neither the local language nor anything they could speak, and who was traveling with a vast assortment of baggage, including what appeared to be a sewing machine.

They also saw train travel as liberating.

“I’ve dreamed about going to an airport, looking at the board and saying, ‘Okay, I want to go there.’ And that’s pretty much what we’ve done,” only by rail, said Nygren, 27.

They bought Pan-European Interrail passes and set out with only a first destination in mind. Then they improvised their way from the Czech Republic to Hungary to Austria to Croatia to Slovenia to Germany. It was the first time either had traveled that way. 

“Before, it would be, like, ‘Okay, I’m traveling to Italy,’ ” Rothin, 23, said. By rail and on the ground, she said, “you can kind of understand the way the countries influence each other,” as one culture shades into another.

Climate change experts caution that meaningful shifts will need to happen on a structural level that goes beyond any individual’s private actions. 

“In terms of personal climate activism broadly, whether you’re talking about aviation, reducing the amount of meat you eat, consumption choices, the answer is always: It is important, but it is insufficient,” said Greg Carlock, a manager at the World Resources Institute, a Washington think tank.

Rail travelers say they simply want to lead climate-friendlier lives — and that they are delighted they already seem to have spurred a move to invest more in the Swedish rail system.

“You can do a lot of things on your own, but you also have to understand it’s part of the ecosystem,” Rothin said.

Karla Adam in London contributed to this report.