Sarcasm is a 'Way' of using words that implies the opposite of what is being said. Used for mocking.
Mockingly, I could say 'You rock (upon any embarrassing incident)' 'You rock'doesn't mean the person is really good; however,it implies the opposite i.e. You're stupid.
Irony isn't generally used for mocking. Although they're quite similar, sarcasm implies negativity, whereas, i