When, while and as can be used to talk about actions or situations that take place at the same time. There are some differences.
When and while
We can use when and while to introduce a longer background action or situation, which is/was going on when something else happens/happened. Note that we usually use a continuous tense for the longer background action or situation.
When- and while-clauses can go at the beginning or end of sentences.
- I was having a bath when the telephone rang. OR When the telephone rang I was having a bath.
- While they were having a nap, somebody broke into the house.
- I was working on that report when Sam called.
- She was waiting for a bus when the accident occurred.
- Cathy broke her arm while she was playing in the garden.
When can mean ‘at the same time as something else’.
- I always wear gloves when I wash clothes.
- She always takes her cellphone when she goes out.
When is used to refer to ages and periods of life. As and while are not possible in this.
- His parents died when he was ten.
- I was eighteen when I got my driving license.
- She was twenty-one when she got married.
While is used to say that two longer actions or situations go/went on at the same time. We can use progressive or simple tenses.
- While he was watching TV, I was working.
- He slept while I cooked supper.
- You can do the dishes while she cooks dinner.
- While she was in Australia, she met a rich businessman and fell in love with him.
- I acquired a strong Canadian accent, while I was holidaying in Toronto.
- I sprained my ankle while I was playing football.
It is often possible to drop subject + be after when and while.
- Start when ready. (= Start when you are ready.)
- While in Australia, we saw many kangaroos. (= While we were in Australia, we saw many kangaroos.)
- I hurt my back, while lifting that box. (= I hurt my back, while I was lifting that box.)
- While in Rome, do as Romans do. (= While you are in Rome, do as Romans do.)
- I learned French, while working in France. (= I learned French, while I was working in France.)
To talk about two short actions or situations that happen/happened at the same time, we usually use as. When is also possible.
- As I opened my eyes, I saw a strange sight. OR When I opened my eyes, I saw a strange sight.
As can also be used to talk about two situations that develop together. We normally use simple tenses.
- As I get older, I get more optimistic.
- As he came into the room, all rose to their feet.
As can be used to introduce a longer background action or situation.
- As I was driving down the street, I saw Peter.