YOU PROBABLY haven’t noticed, but the sun has been more restless lately. Scientists have been predicting an upswing in volatile solar behavior, resulting in “space weather” that poses a surprisingly dangerous threat to modern society. A big “coronal mass ejection” is one of the least commonly discussed natural hazards humanity faces, but experts warn that “everything that plugs into a wall socket” could be at risk if the products of one hit the planet.

The danger is not hypothetical. A huge coronal mass ejection hit the Earth in 1859, inducing dangerous sparks in telegraph offices, some of which burned to the ground. In 1921, the planet saw a similar episode. But humans now rely much more on vast, interconnected electricity grids. A lesser solar event in 1989 knocked out electric power to millions in Quebec. Because humans don’t have extensive experience with large-scale geomagnetic storms in the age of ubiquitous electric power, predicting exactly how one would play out is tough. Still, a National Academy of Sciences study warned in 2009 that the costs could be staggering, ending electric power to millions, permanently damaging power-grid equipment, costing up to $2 trillion during the first year of recovery — and taking four to 10 years to fully rebuild. Even access to basic necessities such as potable water and toilet facilities could be limited because a big coronal mass ejection could knock out the electric pumps that drive public water systems.

But maybe the probability of an extreme coronal mass ejection hitting Earth is low enough to allay concern? Alarmingly, the budding science of space weather tentatively suggests otherwise. A recent NASA write-up highlighted a huge, 1859-style coronal mass ejection that narrowly missed Earth two years ago. It instead slammed into a close-by sun-observing probe built to resist interplanetary stresses, which sent back reams of new data on these events. NASA cited an analysis concluding that the chances Earth will be hit by a similarly large event in the next decade are a too-high-for-comfort 12 percent. That’s higher than the probability that a major earthquake will strike the San Francisco area over the same time period.

The world can and should do more to prepare, adapting satellite systems, toughening electric grids and, above all, ensuring that scientists have the tools they need to anticipate space weather. With some warning, for example, electrical grid operators can adjust the systems they control to avoid damaging “ground currents” induced by the geomagnetic disturbances from large coronal mass ejections. The National Oceanic and Atmospheric Administration maintains the Space Weather Prediction Center, though with a tiny budget. Meanwhile, funding constraints perpetually threaten to erode the coverage of satellite-based sensors that monitor all sorts of phenomena on Earth and elsewhere — including the sun. Congress has a poor record of remembering to keep these sorts of important scientific tools in mind at funding time. For a variety of reasons — including the threat of severely inclement space weather — lawmakers must take a wider view.