Sarcasm and irony are very popular tones used in many and all forms of literary texts, yet there is a lot of confusion as to which is which - however the distinction between the two is actually quite easy! Firstly, you should think of irony as an overarching technique used by writers to enhance their writing, and sarcasm is simply a specific form of irony. Whilst irony can be situational (ie. ending up in the one place you said you'd never return to), dramatic (used a lot in plays - means a situation in which the audience knows something the characters on stage don't), or verbal, sarcasm is strictly verbal. Furthermore, sarcasm's main goal is to ridicule or attack someone, whilst irony is not necessarily mean spirited at all. Let's try some examples:
a) Person A: "I'm going to join the gym this year!" Person B: "Great idea! That worked out so well last year!"
This example would be sarcasm; Person A is being mocked by Person B.
b) A parking enforcement officer gets a parking ticket.
This is an example of situational irony. It's not attacking anyone (so can't be sarcasm), yet still displays irony.