We've had a long phase on and off with hitting and kicking, mainly hitting. We told DS (3) firmly 'no we don't hit', removed him consistently, let him know it wasn't on. Explained hitting hurts, people don't like being hit, etc. Tried to stay calm ourselves, VERY challenging.
When it was at its peak and he was hitting us many times a day almost as a habit we occasionally smacked him back
Not only do I think smacking is wrong and feel horribly ashamed of ever having given even a tap on the hand, it is modelling the very behaviour you want to stop. Unsurprisingly it made things worse. Forcibly moving him to another location for 'time out' didn't work for us. It made DS frantic and hysterical, and the hitting got worse.
The only thing that seems to have really calmed it down is throwing all our old 'you have been naughty' responses out the window. Now we remain calm, firm and (seemingly) non-angry, block the hits if we can and say 'I won't let you hit me' or 'I won't let you hit (Daddy/Billy/whoever)'. If we can't block the hit and he lands one we restrain his arms (as gently as we can) and tell him 'Ouch that hurt, I don't like it' or equivalent, but not getting too wordy like we used to.
Once we're holding his arms from hitting we name the likely feelings he's got - 'can see you're feeling angry/frustrated/sad' and offer alternatives or redirect activities depending on the situation.
It bends my mind a bit as it is really different from how my mum and dad were. I was scared of being told off or getting a smack so mostly did what I was told. DH the same. But DS doesn't respond that way. The key with him seems to be lowering the emotional intensity by being a very calm strong boundary with some empathy plus showing him there's no question in anyone's mind who is in charge. I still find being calm really hard as being hit makes me feel furious! Learning, learning, phew, deep breaths!
Someone suggested this approach, can't remember who but we are forever indebted to them. We still get some hitting when he's feeling anxious and upset, but can see him really trying to modify his reactions now. HUGE and immediate improvement on what we had. I think maybe he feels like we're on his side and trying to help him? Anyway it seems to work when all our usual stuff hasn't.
Hope this helps or you that find something else that does.