Using conjunction al + infinitive/perfect infinitive = when doing/ because of doing [something]

In Spanish, the conjunction al followed by an infinitive is used in clauses that express either When/while doing [something] or Because of doing [something]

When/while doing something

Al calentar la leche, me quemé.When I was heating up the milk, I burned myself.

Se ha desmayado al leer la noticia.She fainted while reading the news.

Because of doing something

Al terminar la sesión antes de lo previsto, pudimos volver a casa antes.Because the session finished earlier than expected, we were able to return home earlier.

Al portarse tan mal, lo expulsaron del colegio.Due to his appalling behaviour, he was expelled from school.

Bear in mind that in the second example, where the al + infinitive structure expresses the cause of something happening, al could also be followed by haber + participle, if it is referring to a past action. See El Infinitivo Compuesto.

Have a look at the previous examples but using the El Infinitivo Compuesto:

Al haber terminado la sesión antes de lo previsto, pudimos volver a casa antes.As the session finished earlier than expected, we were able to return home earlier.

Al haberse portado tan mal, lo expulsaron del colegio.Due to his appalling behaviour, he was expelled from school.

Using the Infinitivo or El Infinitivo Compuesto does not change the meaning of the sentence, therefore they are interchangeable.

Want to make sure your Spanish sounds confident? We’ll map your knowledge and give you free lessons to focus on your gaps and mistakes. Start your Braimap today »

Examples and resources

Al terminar la sesión antes de lo previsto, pudimos volver a casa antes.Because the session finished earlier than expected, we were able to return home earlier.
Al portarse tan mal, lo expulsaron del colegio.Due to his appalling behaviour, he was expelled from school.
Al haberse portado tan mal, lo expulsaron del colegio.Due to his appalling behaviour, he was expelled from school.
Se ha desmayado al leer la noticia.She fainted while reading the news.
Al calentar la leche, me quemé.When I was heating up the milk, I burned myself.
Al haber terminado la sesión antes de lo previsto, pudimos volver a casa antes.As the session finished earlier than expected, we were able to return home earlier.
I'll be right with you...