Can a computer break down if it stays off many years?

Yes. They can.

3 reasons in particular:

  • Biggest problem is that most electronics (and certainly computers) contain components called capacitors that will degrade over time. Some types of capacitors can (and will) burst after a long enough time and will then release a small amount of chemical liquid that will react with and damage the surrounding electronics. Degraded capacitors (even the ones that don't burst) will also not function correctly anymore.
  • The metals/alloys in the electronics are subject to rust. That is a very slow process that can take 50 or longer years to have a serious effect, but eventually some stuff will rust to the point of becoming no longer fit for purpose.
  • Computers contain some lubricated parts (fans, in harddisks). And there is cooling-paste or pads between the components (like the CPU and GPU) that get hot and their heat-sinks. Both lubricants and cooling-paste will dry out and cause issues (moving parts seizing up and components over-heating due to reduced cooling).

You can't just turn something on and expect it to work. You might even do catastrophic damage if you try to turn it on.

Re-conditioning old electronics after long storage to resurrect vintage equipment can be done, but it is a highly specialized job. Not many people have the skills and you also need access to original schematics and replacement parts (which are possibly no longer being made when you need them).

P.S. Buying a computer now for use in say 20 years time is a stupid thing to do anyway. The computer world is rapidly evolving. What is a brand-new computer now will probably not be able to run most software that will be current in 20 years. It simply won't have the technology on-board required for the software that is then current.

E.g. Just take the average computer from the 1990s. Today you can do retro-computing and run vintage software on it, but nobody in his right mind will try to use that computer as a general purpose computer for daily work.
Those old computers don't have enough RAM, have only a single-core and very slow CPU's, video-card is a joke by todays standards, harddisks where measured in MegaByte in stead of TeraByte, etc.

Over 20 years we will look back at today's computers with a similar attitude: Nice museum piece, but not suitable to get real work done.


This has all been covered in comments, but let me set out the frame challenge in an answer.

A computer may or may not last for 10, 20 years or more, whether it's in use or not. Any computer put in storage is a Shrödinger's cat. It may or may not be alive at any moment & you will only find out if it survived when you first try to boot it.
So, let's ignore long-term storage life & look at other factors.

Let's look at a really reliable old Mac - the Mac Pro 'cheesegrater'. I have 4 of them here, aged between 10 & 15 years. I did have 5, one died, the rest are still soldiering on & may continue to do so for many more years. Some of them have been running constantly, never sleeping, only ever rebooting for OS updates, 24/7/365 for over a decade.

Brand new, the most expensive of them would have cost nearly 10 grand. If you'd estimated each one would last 10 years in use & you may live another 50, that's a 40 grand investment to buy 4 & put 3 in storage.
You can currently buy one second hand, fully-loaded, absolute top spec, with uprated graphics, for under 2 grand. That means your stockpile you bought 10 years ago has lost 32 grand in value.

This is not a wise investment. Let someone else suffer the depreciation. If you want a 10-year-old computer, buy a 10-year-old computer for a fraction of its new price.

This is aside from the fact that even after the first 10 years, though the Macs are functioning perfectly, they are now considered obsolete & receive only security updates. Even security updates will not be maintained for long. Another year or two & they'll definitely be 'unsafe' to go online. So your stockpile will eventually be practically unusable in a modern world.
30 years ago, everybody used floppy drives. Your stockpile will eventually become as useless as that. Museum pieces.