DnD 5e - Magic Basics
Dungeons and Dragons uses a "hard magic" system, meaning that magic is defined using a strict set of rules with clearly-defined effects. More specifically, magic in Dungeons and Dragons is "Vancian", meaning that spellcasters are given a specific allotment of spells every time that they rest, and once they use that magic it's gone until they rest again. There's a bit more nuance to it which we'll explore below, but that basic definition is a good starting point.
What Is a Spell?
A spell is a discrete magical effect, defined in specific language. A spell has specific things like a name, a defined range, and required components. In-game, two spellcasters might discuss a spell in the same way real-world craftspeople might discuss a specific tool.
Spells can be versatile tools, weapons, or protective wards. They can deal damage or undo it, impose or remove conditions (see Conditions, later in this guide), drain life energy away, and restore life to the dead.
In-game, thousands of spells have been created, discovered, lost, abd re-discovered throughout the history of the multiverse. Your character might rely on well-known spells, they might discover long-forgotten spells in some ancient tome, or they might even create their own spell, forever leaving their mark on the multiverse. In the real world, you're probably limited to the finite number of spells in official sourcebooks, but if you get ambitious your DM might let you write some of your own spells.
Every spell has a level from 0 to 9. A spell's level indicates how powerful it is and how difficult it is to cast. As your spellcaster gains levels, they will gain access to knew levels of spells.
Cantrips (see below) are "level 0" for the purposes of any effect related to spell level. There are no spells with a listed level of 0, and anything that refers to "leveled spells" generally does not include cantrips.
Spell level and character level don't correspond directly. Honestly you could use many other words in place of "level" when reffering to spells, and the idea that a level X spellcaster can't cast level X spells is often a source of confusiong. "Tier" would be great, for example. But Dungeons and Dragons has used the term "spell level" throughout its history, so I doubt that the official rules will ever abandon the tradition.
Known and Prepared Spells
Before a spellcaster can use a spell, he or she must have the spell firmly fixed in mind, or must have access to the spell in a magic item. Depending on your class, you need to either know a spell or have it prepared. Some classes permanently learn spells, while other classes prepare them after a long rest. For more on known/prepared spells, see Spellcasting Classes, later in this guide.
In every case, the number of spells a caster can have fixed in mind at any given time depends on the character's level. The number varies by class, so check the class's description under Spellcasting or Pact Magic.
Regardless of how many spells a caster knows or prepares, he or she can cast only a limited number of spells before resting. Casting a spell is physically and mentally taxing, and higher-level spells are even more so. Each spellcasting class's description (except that of the warlock) includes a table showing how many spell slots of each spell level a character can use at each character level. For example: A 3rd-level wizard has four 1st-level spell slots and two 2nd-level slots.
When a character casts a spell, he or she expends a slot of that spell's level or higher, effectively "filling" a slot with the spell. You can think of a spell slot as a groove of a certain size-small for a 1st-level slot, larger for a spell of higher level. A 1st-level spell fits into a slot of any size, but a 9th-levei spell fits only in a 9th-level slot. So when our 3rd-level wizard from the previous example casts magic missile, a 1st-level spell, they spend one of their four 1st-level slots and have three remaining, or they can choose to cast it with a 2nd-level spell slot and have one 2nd-level spell slot remaining.
Finishing a long rest restores any expended spell slots (see Resting, earlier in this guide).
Some characters and monsters have special abilities that let them cast spells without using spell slots. For example, a monk who follows the Way of the Four Elements, a warlock who chooses certain eldritch invocations, and a pit fiend from the Nine Hells can all cast spells in such a way.
Casting a Spell at a Higher Level
When a spellcaster casts a spell using a slot that is of a higher level than the spell, the spell assumes the higher level for that casting. Though there isn't an official rules term for this practice, this is frequently referred to as "upcasting" by the Dungeons and Dragons community.
For example: if our example wizard casts magic missile using one of their 2nd-levei slots, that magic missile is 2nd level. Effectively, the spell expands to fill the slot it is put into.
Some spells, such as magic missile and cure wounds, have more powerful effects when cast at a higher level, as detailed in a spell's description. These improved effects may allow the spell to deal more damage, target more creatures, or any number of other benefits.
Cantrips are special spells which can be cast at will, and which never consume a spell slot when cast.
Cantrips are always permanently learned; the published rules provide no mechanism to replace your known cantrips, and even spellcasters who normally memorize spells rather than learning them permanently still learn cantrips permanently.
Unlike other spells, cantrips naturally grow in power as your character gains levels. Cantrips such as Ray of Frost and Eldritch Blast gain additional damage as your character gains levels, improving at 5th, 11th, and 17th level. This improvement is tied to your character's total levels, so even multiclassed characters or characters who learn cantrips from their race or from a feat gain this benefit.
Certain spells are denoted as Rituals. These spells can be cast just like other spells, but they can also be cast as a Ritual.
Casting a spell as a ritual takes 10 minutes longer to cast than normal (10 minutes plus 1 action is surprisingly common for rituals), and doing so does not consume a spell slot. Because casting a ritual doesn't consume a spell slot, you can't choose to cast the spell at a higher level.
To cast a spell as a ritual, a spellcaster must have a feature that grants the ability to do so. The Cleric and the Druid, for example, have such a feature, while the Sorcerer does not. The caster must also have the spell prepared or on his or her list of spells known, unless the character's ritual feature specifies otherwise, as the wizard's does.
For example: Our example wizard has the spell Detect Magic written in their spellbook. Wizards (and only wizards) can cast any spell as a ritual so long as it is written in their spellbook. Our example wizard, suspecting some magic is in effect nearby, spends 10 minutes plus 1 action (10 minutes plus the casting time of Detect Magic) to cast Detect Magic as a Ritual. This does not consume a spell slot, and the spell is treated as being cast at its normal level (1st level), but otherwise functions exactly as it would otherwise.
Not all spellcasters have the ability to cast spells as Rituals. If you want to cast Rituals but normally can't, consider the Ritual Spellcaster feat.