No person, no tense, no mood: only two shapes total
The infinitive belongs to a small class Spanish grammar calls the formas no personales del verbo, the non-personal verb forms, a group it shares with the gerund and the participle. Per the RAE's Nueva gramática, all three lack inflection for person, tense, and mood, and the verbal infinitive and gerund additionally lack number agreement, while adjectival participles can carry gender and number agreement. Lexicalized infinitive nouns such as deberes are a different nominal use: hablado stays hablado regardless of who's talking, while an adjective built from it, like cansado, still has to agree in gender and number. The infinitive's own marker is simply the -r that closes every one of the three conjugation classes, hablar, comer, vivir. Nothing about the word itself signals whether it will end up meaning "to speak," "speaking," or something closer to an instruction on a sign; that job falls entirely to whatever surrounds it.
Spanish gives the infinitive exactly two shapes, not the range of tense-marked forms a finite verb has. The simple infinitive, hablar, comer, vivir, names the action or state with no reference to whether it's finished. The compound infinitive pairs haber with a past participle, haber hablado, haber comido, haber vivido, and marks the action as already complete relative to whatever the main clause describes. Después de haber terminado el informe, se fue a casa ("After having finished the report, they left") points at a report that was done before the leaving happened, a distinction the simple infinitive alone doesn't make on its own.
A common job for the infinitive: filling a noun-like position
English speakers learning Spanish tend to reach for "-ing" whenever a verb needs to act like a noun, because English lets both the gerund and the to-infinitive do that job more or less interchangeably: "Smoking is bad for your health" and "To smoke is bad for your health" are both grammatical, and most English speakers would call "smoking" the more natural of the two. Spanish removes that choice entirely. The Spanish gerund normally functions differently from an English noun-like -ing form: the ordinary Spanish choice in examples such as Fumar es malo para la salud is an infinitive. That sentence says "smoking is bad for your health" in Spanish; there's no gerund-based version to reach for by analogy with English, because Spanish simply doesn't allow one.
The RAE's Buen uso del español draws a further line inside the infinitive itself, between verbal and nominal uses, based on what it's doing in the sentence rather than on its form. In Rocío deseaba comprar una casa, comprar behaves as a verb: it takes a direct object, una casa, the way any conjugated verb would. In el lento caminar de la gente ("the slow walking of the people"), caminar has shifted into nominal behavior: it takes a determiner (el) and an adjective (lento) instead of an adverb, exactly the way an ordinary noun does, and it's followed by de rather than taking a direct object of its own. Same word, same form, two different grammatical jobs, distinguished only by what's attached to it.
After a preposition, including the compact "al + infinitivo"
A verb following a Spanish preposition takes the infinitive in the overwhelming majority of cases, one of the more reliable patterns in the language, and it covers exactly the spots where English switches to "-ing": antes de salir ("before leaving"), después de comer ("after eating"), sin decir nada ("without saying anything"), para aprender ("in order to learn"). The one notable exception is según, which can introduce a fully conjugated clause instead, as in según convenga ("as [it] suits") or según le parezca a ella ("according to how it seems to her"); this is a useful rule for a verb directly following a preposition, not a ban on finite clauses introduced through que, such as después de que termine.
One preposition-plus-infinitive combination is common enough, and flexible enough, to earn its own name: al + infinitivo. Per the RAE's Buen uso del español, the pattern carries either a temporal value ("when," "upon") or a causal one ("because"), depending on context, and it functions as a compact stand-in for a full subordinate clause. Al vernos, se acercó ("Upon seeing us, he came over") is temporal; Al perder los documentos, no pudo realizar el trámite bancario ("Because he lost the documents, he couldn't complete the bank procedure") is causal, doing the work a porque-clause would otherwise do, in fewer words.
The infinitive inside one of these constructions can even carry its own subject, separate from whatever the main clause's subject is, something a finite subordinate clause does routinely but that feels less expected in a form most learners think of as subjectless by nature. The RAE’s Buen uso gives Al salir el sol, partieron as an example with the infinitive’s own subject, el sol. Al oscurecer, refresca un poco el aire ("As it grows dark, the air cools a little") is different: oscurecer in this meaning is impersonal, as the RAE dictionary records, with no silent weather subject. The Nueva gramática chapter on subject correference flags a genuinely ambiguous example, La policía nos informó de la gravedad del accidente muy poco antes de llegar al lugar de los hechos, where antes de llegar can be read as either "before we arrived" or "before the police arrived," because Spanish grammar doesn't force the infinitive's silent subject to match the main clause's subject by default.
Locked inside a periphrasis: deber, tener que, haber de, ir a
The infinitive is also the non-finite half of most Spanish verbal periphrases, a conjugated auxiliary paired with an infinitive that together function as a single verb unit expressing obligation, necessity, or futurity the auxiliary alone couldn't. Four of the most common: deber + infinitivo for obligation (Debes tener más cuidado, "You should be more careful"), tener que + infinitivo for obligation or necessity (Tienes que ayudar a tus hermanos, "You have to help your siblings"), haber de + infinitivo for a more formal obligation (Hemos de intentarlo una vez más, "We must try it once more"), and ir a + infinitivo for near-future action or intention (Voy a esperarla, "I'm going to wait for her").
Deber + infinitivo commonly expresses obligation: Debes tener más cuidado is an instruction. Deber de + infinitivo commonly expresses conjecture: Deben de ser hermanos means "They must be siblings" as an inference. The current DPD allows both constructions for either meaning, although it prefers the version without de for obligation; de alone is not a reliable switch between the meanings. Negating the two obligation-periphrases doesn't work identically either. No debes decírselo a nadie keeps the obligation intact and negates only its content, the obligation not to tell, while No tienes que darme explicaciones negates the obligation's existence altogether: there's no requirement here at all, not "you're required not to explain."
Standing in for a command: legitimate on a sign, a mistake face to face
Spanish signs, product labels, and instruction manuals lean on the bare infinitive constantly: No fumar, Lavar a mano, Depositar la basura en las papeleras, Consumir a temperatura ambiente. The RAE classifies this as a fully valid exhortative use, reserved specifically for indications, warnings, or recommendations aimed at a collective, indeterminate audience, nobody in particular, everybody who happens to read the sign. Grammatically it's closer to an impersonal se debe... ("one should...") than to a direct order, which is exactly why it doesn't clash with the vosotros and usted commands Spanish uses when actually addressing someone.
What the RAE does flag as a mistake is a related but different move: swapping the infinitive in for the vosotros affirmative command when talking to real people standing in front of you, not posting a sign for no one in particular. ¡Sentaros! for ¡Sentaos!, or ¡Venir a echarme una mano! for ¡Venid a echarme una mano!, both appear among the RAE's own examples of the inadvisable version, live, addressed instructions where a genuine command form already exists and gets replaced by the infinitive out of habit, in a register where the RAE recommends avoiding it. The dividing line isn't the infinitive itself; it's whether anyone specific is actually being told to do something.