1) Use a comma to separate items on a list. This always reminds me of a memory game I used to play with my kids on long car journeys:
I went to the shops and I bought an apple, a banana, a cherry and six bars of chocolate.
Be careful to avoid confusion here though:
I went to the shops and bought my favourite sandwiches – hummus, sardine and cheese and tomato.
Now, are we suggesting here that I eat sandwiches with all these fillings? Or that I like hummus sandwiches, and sandwiches that contain sardines AND cheese AND tomato. Or sardine and cheese. Or just cheese and tomato? Commas can clear this up:
I went to the shops and bought my favourite sandwiches – hummus, sardine, and cheese and tomato.
2) Use a comma to separate a series of actions, events or elements in a sentence:
She opened the door, peeped inside, and screamed her head off.
3) Use a comma before a conjunction to connect two independent clauses:
She opened the door quietly, but he still heard her.
This is a case where the comma could be left out, but using it here helps the pace of the sentence, and adds to the suspense.
4) Use a comma after the introductory elements of a sentence:
Opening the door, she felt a scream rise in her throat.
Use a comma to set off parenthetical information:
She opened the door, her heart banging in her chest, and peeped inside.
The bit between the commas can be removed without changing the essential meaning of the sentence.
5) Use a comma to separate adjectives.
She was a scared, pale little thing.
If you can put an ‘and’ between the adjectives, then it’s probably better to use a comma there instead – you might say ‘she was a scared and pale little thing’, but not ‘she was a scared and pale and little thing’.
6) Use a comma when you are writing speech:
‘This door’s hinges,’ she said, ‘are in need of some oil.’
‘I think we should oil the hinges,’ she said.
7) Use a comma before a phrase that expresses a contrast:
‘The door was tall, but not very heavy.’