An earthquake is the one emergency with no warning at all, which makes the conversation about it necessarily happen after, not before.
The official guidance on what to do during the shaking itself, and what to check for once it stops.
Download the PDF ↓Check the current version on Ready.gov →A U.S. government work, free of copyright. We host a copy so you can have it immediately, and link the live version too, because an emergency document that has been updated matters more than a convenient copy. We are not affiliated with, and not endorsed by, FEMA, DHS or any government agency.
"That was scary, the ground moved and it was loud" — naming their actual experience first, before any explanation, tells a child you noticed what happened to them specifically, not just what happened geologically.
"The ground moved because of something happening deep underneath us. It is over now." is a complete, honest explanation for a young child. You do not need geology, and you do not need to speculate about the cause beyond that.
If aftershocks are possible where you live, say so once, calmly, and move on — "sometimes there are smaller shakes after, that is normal and it does not mean it is starting again." Repeating the warning creates more anxiety than an aftershock itself would.
A period of heightened startle after a frightening event is common and usually eases within a few weeks. If it is not easing, or it is disrupting sleep and school significantly, that is worth raising with your paediatrician.
Practising calmly, outside of a real event, is a reasonable way to make the response automatic rather than frightening - the official sheet linked below has the actual guidance on what to practise.
Part of our guide to Talking to kids about emergencies.