You have tickets to a sold-out rock concert and you're among thousands of fans milling outside the doors waiting for it to open. The crowd is getting restive and you’re being jostled from all sides as people get ready to rush the gate. What should you do?

Get out as fast as you can, advises Sheila Sund, MD, who runs the website disasterdoc.net. The best way to avoid stampedes and crowd crushes, she says, is to avoid crowds. Noting in her blog that people have been suffocated or trampled to death at concerts, ballgames and even Black Friday sales, she advises arriving early or late: “Do anything possible to avoid crowds like these.”

But what if you’re already deep inside a venue when a crowd crush or stampede occurs?

Paul Wertheimer of Crowd Management Strategies is one of the country’s foremost crowd safety experts. He served as an expert witness in a Black Friday trampling case, helped develop crowd safety legislation in five countries and has studied crowd crushes from the depths of concert mosh pits. He offers these tips for avoiding — and surviving — a crowd surge, crush or stampede.

Related: 6 Lesser-Known Summer Hazards to Heed

Come up with an exit strategy as soon as you arrive. “Whenever you are at an event, study all of the exit locations,” says Wertheimer. “After all, you never know where you will be should an emergency situation develop.” Evacuating at the nearest exit may not always be the best strategy if there’s an emergency, he says, noting that the main entrance often becomes gridlocked. In these cases, he advises, use a different one. “If you are not among the first to use a main entrance as an exit, another nearby exit may speed you to safety quicker.”

If the crowd around you becomes too dense, leave immediately. Follow your instinct and seek open space if you sense the crowd slowly tightening. If people are pressing against you or even touching you on all four sides, you are in danger of being suffocated. “Crowd crushing is the result of too many people in too little space,” says Wertheimer. “The longer you delay leaving a crowd crush environment, the harder it will be to escape.” The problem is that most people don’t know they’re in danger until it’s too late: Those in the back of a crowd are pressing forward, and they don’t realize that people in the front are falling or being squeezed against a fence or wall with a force that can bend steel.

If you are caught in a crowd crush, keep your hands to your chest and take a boxer’s stance. “First, do not try to resist the force of the crowd,” Wertheimer says. “It is too powerful. You will need all of your strength for your escape. Instead, use the surging of the crowd to your favor. To prepare for the crushing and surging, you need to establish, as best as possible, a firm footing and an effective stance. Take a boxer’s stance, one foot in front of another. Keep your hands up to your chest. If they remain at your side, you will lose use of them and compromise your balance and chest protection, as well.”

Remain calm to preserve energy and oxygen. Don’t scream, yell or push, Wertheimer says. Use gestures to communicate.

Related: Fireworks: Don't Try this at Home

Stay on your feet during each crowd surge.“When the surge pushes you, move in the direction of least resistance,” says Wertheimer. “In other words, resist the force of the crowd crush surge that is pushing you just enough to remain standing (and to help keep others around you standing). This means you will probably be pushed a foot or a few feet by the crushing force of the crowd.”

Prevent yourself and others from a deadly fall. “It is not enough to assure your safety; the safety of those around you is important, too. You are all in this mess together,” says Wertheimer. “Do everything you can to ensure that neither you nor anyone falls down," he says, adding that if someone extends a hand for help, grab it to keep him upright. “A crowd collapse can be a point of no return for those who fall.”

The good news, according to Wertheimer, is that people caught in a crowd crush tend to be compassionate and help others, even at risk to their own lives. The biggest danger is not being trampled but dying of suffocation by being squeezed together too tightly to breathe.

Use the “accordion technique” to weave your way to safety. When a crush surge passes, a lull will likely follow, says Wertheimer. “Crowd surges are like waves along the shore. They move back and forth. In between the tide, there is a moment of calm. That is when you make your moves. So, it won’t be a straight line to safety and comfort. Your exit route will use the “weave” technique as you move in and around people in zig-zag style, likely in a diagonal direction” to the periphery — and freedom.

Related: 9 Ways Your Cellphone Can Save Your Life

Alan Black is a soccer writer and author and a former children’s soccer coach in northern California. He writes for the San Francisco Chronicle, the Huffington Post and other publications.