How to use “Al” in Spanish before infinitives to mean when doing something

Introduction

Spanish uses a short construction with al followed by an infinitive to express actions that happen when doing something. This little structure is common in spoken and written Spanish. In this article you will learn when and how to use al + infinitive, see many clear examples, and understand small differences from similar phrases.

What does al + infinitive mean?

The preposition al in this construction is a contraction of a + el. When it is followed by an infinitive verb, it usually means when or upon doing that verb. It links two actions: the action named by the infinitive and another action that happens at the same moment or as a consequence.

Think of al + infinitive as meaning at the time of, when, or upon. It often answers the question when did something happen or under what circumstance.

Basic structure and grammar rules

Structure:
al + infinitive + main clause

Examples follow this order most of the time, but the infinitive phrase can appear at the end for emphasis.

Rule 1: The infinitive is always in the base form (no conjugation), because al needs an infinitive noun-like verb.

Rule 2: Al is used for simultaneous or immediately related actions. It is different from cuando when you want a more general time reference.

How to form sentences

Use al + infinitive to state that something happens at the moment of performing the infinitive action. The main clause describes what happens when the infinitive occurs.

Example:
Al llegar, apagué el teléfono.
Here the action of arriving and the action of turning off the phone are linked: upon arriving, I switched off my phone.

Notice the infinitive llegar stays the same despite the subject. The subject of the infinitive is usually the same as the subject of the main clause. If subjects differ, Spanish prefers using a subordinate clause with que or a different construction.

Common uses and examples

Use cases include describing arrival or departure, reactions, immediate consequences, and short sequences of actions.

Arrival or beginning of an event

These are very common:
Al llegar, vi a María.
Al abrir la puerta, entraron los invitados.

Both sentences indicate what happened when the speaker arrived or when the door was opened. English alternatives are when I arrived and upon opening the door.

Immediate reaction

Use al + infinitive to express reactions that occur the instant something happens.
Al escuchar la noticia, lloré.
Al ver la factura, me sorprendí.

These examples emphasize the immediate emotional or physical response to an event.

Simultaneous actions

You can show two actions happening at the same time:
Al correr, escucho música.
Al estudiar, me gusta tener silencio.

Here the infinitive indicates an action during which the main action occurs — while running I listen to music; while studying I like silence.

Cause and consequence

Sometimes al + infinitive implies that one action causes another.
Al beber tanto, perdió el juicio.
Al no dormir, me siento cansado.

The first example links drinking excessively to losing judgment, and the second links not sleeping to feeling tired. In English these often translate as because or as a result of, but Spanish uses the temporal nuance when or upon.

Short comparison with cuando and mientras

Knowing when to use al + infinitive instead of cuando or mientras helps you sound natural.

Al vs cuando

Use al for specific moments or immediate actions. Cuando is more general and can introduce longer time frames or habitual situations.

Example:
Al llegar, apagué el teléfono. (specific moment of arrival)
Cuando llegué a casa, apagué el teléfono. (more descriptive; uses a conjugated verb)

Notice that cuando requires a conjugated verb if referring to a specific past action, while al uses an infinitive.

Al vs mientras

While suggests duration. Use mientras to emphasize that two actions happened over the same period. Use al for actions that mark a point in time or an immediate event.

Example:
Al estudiar, escucho música. (at the moment I study, or whenever I sit to study — short phrase)
Mientras estudio, escucho música. (during the entire study session I listen to music)

Subjects and agreement in the construction

The implicit subject of the infinitive is usually the same as the subject of the main clause. If the subjects differ, you cannot use al + infinitive without clarification.

Correct:
Al entrar, la casa ya estaba cerrada.
The subject implied by entrar is the same as the subject of estaba.

Problematic:
Al ver, María llamó.
This is ambiguous because it sounds like the speaker saw something, then María called. To clarify if María is the one who saw, use cuando or a que clause:
Cuando María vio, llamó or Al ver eso, María llamó is okay if context makes María the subject of ver evident.

Expressing different subjects

If two different people do the actions, use a subordinate clause with que and a conjugated verb or rephrase the sentence.
Instead of Al llegar, Juan llamó, say Cuando llegó Juan, llamó or Juan llamó al llegar a la estación (this still implies Juan is the subject of llegar when context is clear).

Negative and reflexive forms

Negative infinitives work the same: add no before the verb if needed or use no with the main clause depending on what you negate.

Example:
No hables al conducir. (Do not talk while driving)
Al no dormir bien, me siento mal. (When I do not sleep well, I feel bad)

Reflexive verbs keep the reflexive pronoun attached to the infinitive.
Example:
Al levantarse, se duchó.
Al acordarme, llamé a mi madre.

Common mistakes and how to avoid them

Mistake 1: Trying to conjugate the verb after al. Remember the verb must be infinitive. Wrong: Al llegué. Right: Al llegar.

Mistake 2: Using al when subjects differ without clarifying. Always check who performs the infinitive action versus who performs the main clause action.

Mistake 3: Overusing al when a different connector sounds more natural. If you need to express habitual actions, use cuando or cada vez que. If you need duration, use mientras.

More examples with translations and notes

Al salir, cerré la puerta.
Upon leaving, I closed the door. (immediate action)

Al terminar el examen, respiré profundo.
When I finished the exam, I breathed deeply. (instant relief)

Al cocinar, pongo música.
When I cook, I play music. (habitual, common usage)

Al no encontrar trabajo, decidió volver a su ciudad.
Not finding work, he decided to return to his city. (cause and consequence)

Al hablar con ella, noté su acento.
When talking with her, I noticed her accent. (simultaneous observation)

Notes on formality and register

The al + infinitive structure is neutral and fits both spoken and written Spanish. It is particularly common in narratives, instructions, and everyday conversation where short, clear timing is needed.

In very formal writing you might prefer subordinate clauses with cuando or en cuanto, but al + infinitive is perfectly acceptable and natural in most contexts.

Regional and stylistic variations

This construction is widely used across Spanish-speaking countries. Differences are mostly stylistic rather than grammatical. Some speakers may prefer cuando for clarity, especially in complex sentences or formal prose.

In Latin America and Spain alike, you will hear sentences like Al llegar or Al abrir frequently in everyday speech.

Quick reference guide

When to use al + infinitive:
– To indicate when something happens at the moment of another action.
– To show immediate reactions or consequences.
– To express actions that happen simultaneously with or upon the infinitive action.

When not to use it:
– When the subjects are different and you need to be explicit.
– When indicating duration (use mientras).
– When describing general habitual time that sounds better with cuando or cada vez que.

Conclusion

The al + infinitive construction is a compact and useful tool to say when or upon doing something. It keeps sentences short and natural and appears often in spoken and written Spanish. Remember the verb remains an infinitive, the implied subject usually matches the main clause, and use alternatives like cuando or mientras when you need more precision. Practice noticing this structure in real sentences to internalize its timing and nuance.