I tend to freeze the first moment because it catches me off guard. These days I also use that moment - it's a reaction others are expecting you to have anyways, so you may as well put it to use - to check up on them (current moment, their situation at home, their past, their feelings, and what might've triggered it). 90 percent of the time, when someone is yelling at you, it's not even about you. With loved ones, this is even easier to see, and that means that with them I have more information to work with for the next step and will try longer.
Next, I use that information to try and defuse the situation by saying something disarming or - if I think it will help - to redirect them to the source of their anger and really let it all out. If it *is* my fault that they're angry, I'll also apologise and explain myself, but usually if they're at the point of yelling, there is more going on than my blunder, I've noticed.
If they respond positively, we talk it out and release that pain, or at least let them have a moment with that awareness. If they stick to being justified in their anger and keep yelling, and become defensive and arrogant, I move on to match them in intensity - whether that requires yelling or just what I call 'solid brick wording'.
Some people enjoy the power that anger gives them too much to care where it came from and need to be shown that, ya know what, it aint going to get you *anywhere* and perhaps spooked a little themselves by having someone else match their intensity and even show the capacity of going beyond - a battle of wills if you will, to take the air out of their tires.
If they need to yell more, but aren't escalating, I'll stick to the 'solid brick wall' part while trying to hear the message through their frustration until they're able to work through the anger, all the way. I don't mind people having to vent off frustration, as long as they don't do it in a power-hungry *must feel superior to you and completely beat the crap out of you* way.
Im perfectly comfortable with intense emotion and I don't mind people using it to communicate as long as they're aware that it is *theirs*, and they take ownership of what they're doing. If they're going out of their way to make their anger a) my problem and b) blame me for it alongside, I walk away.
Learn some fucking awareness and take ownership of your own emotions - just because you don't know how to handle them doesn't mean you get to make them someone elses problem, you ****. I'll even help you figure it out, but I won't enable you by becoming your toxic waste dumpsite, so you can avoid having to deal with your own shit.
Usually, after that, they either back down and take stock - and I immediately deflate my own intensity to match theirs as they pause, so we can start talking. If they do the toxic waste dumpsite trick, I I walk away - effectively putting them in time out, while making it clear they can come and talk to me when they feel more up to it.
I could skip the matching-intensity part, but a) I rather enjoy it myself, it's rare I get to let lose like that and b) I've found it more effective in combination with walking away, than just doing the walking away thing, in communicating my message and avoiding future incidents.
Most people get really pissed and frustrated if you put them instantly in time-out with no other warning because their anger has nowhere to go. Ive been at that point myself, it's a really annoying feeling - but, it works as a strategy, though it can leave lingering resentment if nothing gets talked out. Matching theirs is in fact what they want/need, because it *gives* them something to yell at, but at the same time can also shock them back out of it once it's fulfilled its purpose - especially if you can make them feel heard as you're pushing back. Meanwhile, it can also shock bullies who aren't used to resistance out of their power trip, and provoke awareness in them.
That said, I don't feed power junkies who just project everything on others and refuse to even acknowledge, let alone take responsibility for their own emotions, so the walking away is to keep it from becoming an unending shouting match - and deprive them of their 'reward' for abusing you by refusing to let them unload a feeling on you that they don't know what to do with, and the euphoria and ego and power-boost it gives them when they get to use you as a release valve - while communicating that I won't put up with this behaviour, but I *am* willing to help them process it and talk about the situation once they've cooled off.