Residents of Hammarby Sjöstad, a district on the south side of Stockholm, Sweden, don't let their waste go to waste. Every building in the district boasts an array of pneumatic tubes, like larger versions of the ones that whooshed checks from cars to bank tellers back in the day. One tube carries combustible waste to a plant where it is burned to make heat and electricity. Another zips food waste and other biomatter away to be composted and made into fertilizer. Yet another takes recyclables to a sorting facility.

Meanwhile, wastewater is taken to a treatment plant, from whence it emerges as biosolids for more compost, biogas for heat and transportation fuel, and pure water to cool a power plant, which also runs on biofuels grown with the biosolids. Looking at a chart of all this is enough to induce dizziness. "In terms of what you can do at the local level for energy efficiency and renewable energy, it's incredible. It's just amazing," says Joan Fitzgerald, author of Emerald Cities (Oxford University Press, 2010).

After they are done district authorities hope Hammarby Sjöstad will produce about half its power independently, a task made easier by the fact that residents, thanks to a broad range of efficiency and conservation measures, will consume half the energy of the average Swede (who already consumes only about 75 percent as much as the average American). These intrepid Swedish urbanites are pushing the envelope on a phenomenon catching on in cities across the developed world: "distributed energy."

Though it takes many forms, distributed energy boils down to two basic strategies: The first is to harvest as much power as possible locally, close to where it is consumed, from small-scale, low-carbon sources. The second is to wring the maximum amount of useful work out of every unit of energy available. The overarching goal is to create resilient, self-reliant cities prepared for the economic and political volatility ahead in the 21st century.

More options than ever are available for local, low-carbon energy. Solar photovoltaic panels are falling steadily in price, and solar power plants are being scaled down to the range of 20 to 30 megawatts—small enough to occupy already developed urban land. Passive solar, the use of direct sunlight for water or space heating, is already a well-developed, low-cost practice. In countries such as Israel and in the cities of Dezhou and Rizhao in China, more than 90 percent of buildings have passive solar water heaters.

Geothermal energy for space and water heating is also well established. Boise, Idaho, has had a business district geothermal heating system since 1983; last year residents voted to expand the network. The U.S. Department of Energy has identified 271 cities within eight kilometers of geothermal resources sufficient to provide useful heat. Many cities that do not have access to solar or geothermal resources, like those in the southeastern U.S., have copious biomass available. And every city in the world produces a waste stream that can be used to make electricity, biogas or, like the Bowerman Landfill in Orange County, Calif., liquid natural gas to fuel transit systems. Natural gas fuel cells are also reaching viability at everything from the household scale to the district level. (For example, there is the recent, much-celebrated Bloom Box.)

At least for the foreseeable future, however, local generation is unlikely to supply the sheer quantity of energy that large fossil-fuel plants now provide, and urban populations are projected to continue expanding. Thus follows the second imperative of distributed energy: to maximize the utility of every bit of energy. By some estimates, more than two thirds of the primary energy that enters the U.S. economy is ultimately wasted. For virtually any urban area, "negawatts"—energy saved through intelligent use of resources—could become the largest source of local energy.

The best way to get more out of energy, by a fairly wide margin, is low-tech and unsexy: density. Living close together offers a number of inherent efficiencies: residents can take public transit, walk or bicycle rather than drive; and urban living spaces, which tend to be more compact than rural or suburban homes, are less energy-intensive to heat and cool.

Another key strategy is to make use of the extraordinary amount of heat that is wasted today. Virtually every industrial process, from smelting coke to generating power, creates heat as a by-product, and the vast majority is simply vented into the air or water. That heat can be used to create power or to warm neighboring buildings. So-called district heating, which uses one source to heat multiple buildings, may be the oldest, cheapest and most widespread distributed energy technology in the world. District heating systems have been in place in New York City, Detroit and Birmingham, Ala., for more than a century, and many other cities are now following their lead, including Portland, Ore. "The upside is competitive rates, green energy, long-run price stability, and reduced capital costs for developers," says Rob Bennett of the Portland Sustainability Institute.

The ultimate way to maximize efficiency, though, remains the most speculative, and that is the use of information technology for ubiquitous awareness and intelligence. Even as prices rise for concrete, steel, oil, coal and water, one commodity gets steadily and inexorably cheaper: computing power. As sensors and microchips become smaller, less expensive and more powerful, they will be integrated not only into the power distribution system (the "smart grid") but into countless appliances, buildings, vehicles and public resources.

The seeds of this approach have been planted in places like Boulder, Colo., and Austin, Tex., which have deployed thousands of smart meters. In its new Pecan Street Project, Austin is building houses wired with communications systems capable of managing the charging and discharging of electric car batteries based on the hour-to-hour cost of electricity. "The communication protocols being developed for the cars will transfer into energy management of every kind at the home level," says Larry Alford, manager of distributed generation at Austin Energy. The effectiveness of intelligent grids will be enhanced by new ways of storing electricity at the building and neighborhood levels. It is energy storage coupled with the smart grid, Alford says, "that enables grid security, grid stability and power quality."

One benefit of energy localism that is difficult to quantify but nonetheless significant is that it engages a city's residents in a more active civic role: People sort their trash, they manage their power consumption, they get involved. "You build it through city pride," Fitzgerald says. "It's a visible thing people feel proud about. Then they're more amenable to doing other things."

In many ways the evolution of centralized energy into distributed energy parallels the evolution of computers from central mainframes to PCs and smart phones, and it may have many of the same democratizing effects. Putting information technology in more hands enabled an explosion of innovation and experimentation. If cities can incubate a new round of innovation, spurred by the dispersion of energy technology, they will leave behind brittle 20th-century energy systems to create new models of resilient, self-reliant and sustainable prosperity.