Our planet is covered by tectonic plates that are slowly moving around, pushing into or sliding past one another along boundaries called faults. Friction sometimes causes two of these plates to get stuck to each other at spots along a fault. Tension builds up over years, decades or even centuries until suddenly the fault snaps. The two sides lurch past each other, unleashing an earthquake.

From the place where the fault ruptures, seismic waves ripple outward in all directions. When they reach Earth’s surface, they can set buildings or any other structures shaking—violently and destructively if the quake is strong and close enough, as were the two massive temblors that struck Turkey and Syria on February 6, which was followed by a large aftershock on the same day.

These quakes killed more than 45,000 people, many of them in collapsed buildings. Though earthquakes can’t be prevented or predicted, science does have some ways to protect buildings—and the people inside them. Scientific American spoke with several earthquake engineering experts to learn more about how using the right building methods can prevent homes, offices and other structures from succumbing to the capricious movements of the Earth.

What happens to a building during a quake?

Imagine you’re driving a car down the road, and you suddenly need to stop. As you slam on the brakes, those groceries sitting on the passenger seat (and anything else not strapped down) will fly through the air in the same direction and at the same speed as the car was originally going. This is because of inertia—an object’s tendency to stay at rest or to maintain a uniform speed and path until some other force acts on it. That same tendency is what puts a building at risk during an earthquake.

During a quake, the ground beneath a building moves quickly back and forth. But because the building has mass, it has inertia. “The earthquake is shaking the ground, and the building is trying to stay put,” says Ertugrul Taciroglu, a structural engineer at the University of California, Los Angeles. But once it does start moving, the building wants to keep going in whatever direction the earthquake has pulled it—essentially, it is always lagging behind the ground motion. These lags generate horizontal inertial forces on the building, causing any vertical columns and walls to deform at an angle (creating a parallelogram shape if one were looking at a side view of a rectangular building). When a building has multiple stories, each story is holding up the weight of those above it. That means lower stories have to bear larger inertial forces than those above. If walls and columns are not properly designed or reinforced, they may not be able to support the weight they once held.

The larger an earthquake is and the closer it is to the surface —and the nearer a building is to the fault rupture—the larger the inertial forces will be on that building during a quake. The type of ground a building is sitting on can also play a role: compared with hard rock, looser soils magnify ground motions.

How do we build buildings so they don’t collapse during an earthquake?

To keep a building intact when an earthquake hits, it needs to be constructed to resist horizontal inertial forces. Exactly how that can be done depends on the building material being used. Let’s focus on two of the most common: concrete and steel. Much of the building stock in the affected area of Turkey used these materials.

Under normal circumstances, concrete is a great material for holding the weight of a building because it performs well under what engineers call compression. A concrete building can easily last for decades if it only has to support its own weight. Yet the quake-generated inertial forces that set vertical walls and columns swaying put the concrete into tension, the opposite of compression. Although the forces are trying to stretch the concrete out, “it doesn’t give. It doesn’t let the building form move but tries to hold on really tight, and it generates these inertial large forces,” says Perry Adebar, a structural engineer at the University of British Columbia. The stressed concrete columns and walls can eventually crack and fail because they can no longer support the weight above them.

Concrete is still one of the most widely used building materials in the world, in part because it is cheap and abundant and because it has an ability to bear structural weight. To make concrete more suitable for seismically active areas, engineers add steel (in the form of rebar), which is much more flexible. “You have to put steel in wherever you're going to have tension,” Adebar says.

Steel behaves elastically when subjected to a certain amount of tension. Think of tugging gently on the bottom of a wire coat hanger and seeing it bounce back into shape when you let go. But when subjected to larger amounts of tension, such as in a very strong quake, steel “becomes plastic and deformed,” Adebar explains. Think of pulling hard enough on the bottom of the coat hanger that it bends out of shape. In the case of a building during an earthquake, “that’s just exactly what you want,” Adebar says, because the deformed steel has effectively absorbed those inertial forces but can still hold up weight.

Doesn’t that mean the building is damaged?

In a large earthquake, yes. Steel-reinforced concrete buildings can still sustain considerable damage, possibly to the point that they will be unusable after the quake. This has to do with the way governments set building codes, which tell engineers how to design a building to withstand a certain level of earthquake shaking. Codes, including those in the U.S. and Turkey, generally require that a building achieves what is called “life safety” under a given maximum expected earthquake in an area. “Our seismic codes are only a minimum requirement,” says Sissy Nikolaou, research earthquake engineer at the National Institute of Standards and Technology. “You just want these buildings at least to give you the chance to get out of it alive when the big one happens, under the assumption that they may be seriously damaged.” The situation is akin to a car that crumples in a crash: the vehicle absorbs the impact to protect passengers, but it is totaled.

There are, of course, different standards for buildings or other infrastructure that are considered critical and that need to keep functioning after a quake—for example, hospitals. Experts such as Nikolaou are also beginning to rethink the life-safety standard so that more structures are usable after an earthquake. Doing so could avoid situations where people are kept out of their homes for months or years. Many people in Turkey now face this possibility, with tens of thousands of buildings deemed at risk of collapse from damage sustained in the February 6 quakes.

There are ways to keep buildings habitable after an earthquake. Some methods involve smarter designs with common materials such as steel-reinforced concrete. It can also require more technological approaches, such as “base isolation.” With this technique, a building is not rigidly attached to its foundation. Instead it sits atop flexible structures that decouple it from the foundation—and therefore from shaking ground. This type of system adds to construction costs, though, and some building owners would be unable or unwilling to pay for it. In the U.S., it has been used to protect crucial structures such as hospitals and to retrofit historic buildings while preserving their original architecture. Some hospitals in Turkey had base-isolation systems and withstood the recent quakes there.

Why might a building fail even if it is built to earthquake codes?

Buildings are designed to withstand a certain level of shaking, based on the seismic risks in their location. A building in Los Angeles, for example, would be built to withstand a larger earthquake than one in New York City. But seismologists don’t always know exactly how big of an earthquake a fault can produce. “The major difficulty in engineering design is the uncertainty about the future earthquakes, because we don’t know what will happen precisely,” Taciroglu says. The bigger the magnitude, the rarer the quake. Some of the biggest may only happen every few hundred or thousand years—but modern seismic measurements only go back a few decades. Many seismologists thought the East Anatolian Fault—the one involved in the Turkey-Syria quakes—was likely to produce a maximum magnitude of 7.4 or 7.5. But the February 6 earthquake was a 7.8—about four times bigger on the logarithmic scale of earthquake magnitudes. So it is possible that some structures built to code in Turkey may simply have experienced more force than they were built to withstand, Taciroglu says.

Building codes also evolve as science’s understanding of earthquake risk and engineering change, so a building that was been built to code at the time it was constructed might not meet updated standards. Retrofitting such buildings is often cost-prohibitive. Taciroglu says this is likely the reason many of the buildings in Turkey were severely damaged or collapsed.

Human error can also come into play. It may range from intentional, profit-driven cuttings of corners to honest mistakes that can happen at various points in the design or building process—and that aren’t revealed unless something like a massive earthquake comes along.