Definition
A cache is a technology that temporarily stores data you use often, or are likely to need again, in a faster and closer place. Instead of going all the way to a distant storage location or the original server every time, the computer grabs the data from a nearby temporary spot, which cuts processing time a lot.
Why keep books on your desk?
If you walked up to the library on the second floor every time you wanted to read, it would take a long time. So you keep the textbook you're studying and the dictionary you look up all the time right on your desk. They sit within arm's reach.
Computers and phones work the same way. The central processing unit (CPU), which handles complicated calculations, and the web browser you use both lose a lot of time when they have to go find data in far-away storage or on a server overseas.
So they keep data that is likely to be used again, such as a photo you loaded recently, a web page file, or a calculation result, in a very close, very fast temporary memory space ahead of time. That temporary stash of ready-to-go data is what we call a cache.
It's like keeping your favorite pens in a pen cup instead of the back of a drawer. Devices keep the data they use most right next to them.
Cache hit and cache miss
When a computer needs data, it first peeks into the cache. If the data is sitting right there, that's called a cache hit. It's like reaching out and picking a book off your desk, so the screen opens in an instant.
If the data isn't in the cache, that's called a cache miss. Now the computer has no choice but to go all the way to the original storage or to a web server across the ocean. It's like finding no book on your desk and having to make the trip to the library.
Once the computer brings the data back, it thinks, "I might need this again," and quietly copies it into the cache. That way, the next time can be a fast cache hit.
This is why a website loads noticeably faster the second time you visit it than the first.
To be more precise: why it isn't magic
To be more precise, a cache can't hold unlimited data. A cache built from ultra-fast memory, like the one inside a CPU, performs great but costs a lot, so it has to be small. Caches kept on storage, like browser or app caches, can't take up unlimited space either.
When the space fills up, some data has to go. A common rule is to throw out the data that hasn't been used for the longest time and put new data in its place. The "Clear app cache" button you sometimes tap in your phone settings is you emptying an app's temporary data from storage by hand.
Another problem is freshness. If the original web page or a photo on the server has changed but the cache still holds the old version, you end up looking at an outdated screen.
That's exactly why, when the latest news or an updated page doesn't show up, you do a hard refresh to skip the cache and fetch a fresh copy from the server.
Common misconceptions
If you clear the cache, all your account info and important photos get deleted.
A cache is just temporary copies made to speed things up. It has nothing to do with your original files or account info, so clearing it is safe.
Where you meet it
A portal site you visit often shows its logo and icons instantly, without a refresh.
Thumbnails in your recently watched list pop up right away in the YouTube app on your phone.
In one sentence
A cache is a temporary storage technique that copies often-used data to a nearby spot ahead of time so you can get it fast.