It's a stress mark, not decoration
Most Spanish words carry no written accent at all, and that's normal, not an oversight. The tilde over a vowel exists for one job: marking where the spoken stress falls when the spelling alone wouldn't tell you. Spanish syllables are classified by where that stress lands: agudas stress the last syllable, llanas (also called graves) stress the second-to-last, esdrújulas stress the third-to-last, and sobresdrújulas (which only occur when a verb has one or more pronouns attached to the end) stress a syllable even earlier than that, per the RAE's own classification of word types by stress position.
Spanish spelling already predicts stress placement most of the time, which is exactly why most words don't need a written accent. A tilde only shows up when a word breaks the pattern its ending would otherwise predict, or, in a separate, smaller set of cases, when two words are spelled identically and the accent is the only thing telling them apart.
The default pattern, and what breaks it
Two stress patterns count as "default" in Spanish, meaning they get no written accent even though the word is genuinely stressed somewhere. Agudas (last-syllable stress) default to ending in any consonant other than n or s (reloj, feliz, ciudad, papel): no tilde needed, because that's exactly what an aguda word is expected to do. Llanas (second-to-last-syllable stress) default the other way: they're expected to end in a vowel, n, or s (casa, joven, examen, crisis), again with no tilde, because that ending already signals where the stress falls.
A written accent appears precisely when a word breaks its own default. An aguda that ends in a vowel, or in n or s not preceded by another consonant, needs a tilde to override the llana reading that ending would otherwise suggest: razón, colibrí, compás, revisó. That "not preceded by another consonant" clause matters: agudas ending in -s that follows a second consonant, like robots, tictacs, and zigzags, stay untilded, because that -s cluster doesn't read as the plain vowel-or-n-or-s ending the rule is built around. A llana that ends in any consonant other than n or s needs a tilde for the opposite reason: lápiz, árbol, azúcar, túnel. Esdrújulas and sobresdrújulas skip the whole calculation: per the RAE's rules of graphic accentuation, they're always written with a tilde, no exceptions (análisis, rápido, hábitat, cuéntamelo).
The diacritical tilde: telling two identical words apart
A second, unrelated category of accent has nothing to do with stress rules at all. Spanish has a closed, tradition-fixed list of monosyllables that are spelled identically whether or not they're stressed, so the tilde is the only visual signal separating a tonic (stressed, meaningful-on-its-own) word from an atonic (unstressed, grammatical-glue) one that happens to look the same. Per the RAE's entry on the diacritical tilde, the core pairs are tú ("you," subject pronoun) versus tu ("your"), él ("he/him") versus el ("the"), sí ("yes," or the reflexive "itself") versus si ("if"), dé (the subjunctive/command form of dar) versus de ("of/from"), sé ("I know," or the command form of ser) versus se (the reflexive particle), té ("tea") versus te (the object pronoun "you"), mí (the prepositional pronoun "me") versus mi ("my"), and más ("more") versus mas (an old-fashioned literary "but," rare outside formal writing).
None of these pairs follow the agudas/llanas logic from the section above: both members of each pair are monosyllables, so neither one would take a written accent under the ordinary stress rules. The tilde is doing a completely different job here: distinguishing meaning, not marking stress placement that the spelling wouldn't already predict.
Question words versus everyday connectors: cuándo and cuando
A related but distinct set of diacritical tildes covers polysyllabic interrogative and exclamative words: qué, cuál, quién, cómo, cuán, cuánto, cuándo, dónde, and adónde, per the RAE's dedicated entry on this group. These carry the tilde whenever they're asking or exclaiming something, directly, as in ¿Cuándo llegas? ("When are you arriving?"), or indirectly inside a larger sentence, as in No sé cuándo llega ("I don't know when he's arriving"). Their unaccented twins (que, cual, quien, como, cuando, donde) do a completely different grammatical job as relative pronouns or conjunctions: Llegó cuando quiso ("He arrived when he wanted to") uses cuando as a plain connector joining two clauses, with no question implied anywhere in the sentence.
That same unaccented cuando shows up as the connector Spanish uses to introduce future-oriented temporal clauses that trigger the subjunctive mood, as in Te llamaré cuando llegue ("I'll call you when I arrive"): a completely different function from the accented cuándo asking when something happens. Mixing the two up doesn't just look like a typo to a Spanish reader; ¿Sabes cuando llega? without the tilde reads as a garbled half-question, because dropping the accent quietly turns an interrogative into a connector that isn't asking anything.
The 2010 reform: solo and the demonstratives lost their accent
For decades, style guides taught sólo (the adverb meaning "only") as requiring a diacritical tilde whenever a sentence was genuinely ambiguous with solo the adjective ("alone"): for instance, ¿Trabajas sólo los lunes? ("Do you work only on Mondays?" versus "Do you work alone on Mondays?"). The same held for éste/ésta/aquél as the accented forms of the demonstrative pronouns in equally ambiguous contexts, versus their unaccented adjective counterparts. Even under RAE's pre-2010 rules, dating back to 1959, the tilde had already been optional wherever no real ambiguity existed; the 2010 Ortografía de la lengua española went further and dropped the requirement even in those genuinely ambiguous cases. Per the Academia's own explanatory notice on the change, both solo and the demonstrative pronouns este, ese, and aquel (with their feminine and plural forms) are now written without a tilde as the standard, RAE-endorsed practice: the accent is optional in genuinely ambiguous cases, never required.
The RAE's stated reasoning is worth knowing, because it explains why this wasn't just a style preference: the traditional diacritical tilde is supposed to separate a stressed (tonic) word from an unstressed (atonic) one that's spelled the same way, the way tú and tu work above. But solo the adverb and solo the adjective are both stressed the same way; so are the demonstrative pronoun este and the demonstrative adjective este. There's no tonic/atonic contrast to mark in the first place, which is why the Academia dropped the requirement rather than just relaxing it. This is exactly the rule that trips up otherwise-careful learners, since a lot of English-language grammar content on the web still teaches the pre-2010 version as current.
Applying it without re-deriving the rules every time
In practice, fluent Spanish writers aren't running the agudas/llanas calculation on every word; they've simply memorized where the tildes go, the same way English speakers don't consciously apply spelling rules to write "receive" correctly. For a learner, the fastest path to the same fluency is counting backward from the end of an unfamiliar word: is the stress on the last syllable, the second-to-last, or further back? Check that against what the ending would predict by default. If the two disagree, the word needs a tilde.
The diacritical pairs and the interrogative set are worth memorizing as a fixed list rather than deriving, since they don't follow the stress rules at all. And it's worth knowing that casual Spanish writing (texting, social media, quick notes) routinely drops accents that formal writing keeps; that's a register choice speakers make deliberately, not evidence that the accent doesn't matter. In anything meant to be read as standard, correctly punctuated Spanish, the RAE's rules above are still the ones in force.