Of the 1,554 747s built up to June of 2019, somewhere between 22 and 28, depending on what you want to count.
22 have permanently stopped flying due to crashing into things,
4 have exploded or disintegrated in mid-air,
1 has been shot down, and
1 has been destroyed by another 747 crashing into it.
I’ll give more detail on these 28 below. In addition to these, the Flight Safety Foundation’s Aviation Safety Network database lists another 130 “occurrences” and another 35 “hull losses” involving 747s since 1970.
I had to actually read through all 158 “occurrences,” though, because: that database includes not only accidents, but also hijackings, criminal acts, and “other,” and there is no equivalence between the terms “occurrence,” “hull loss” and “crash.”
There are also many, many cases of 747s that were repaired and returned to service even after they banged their tails while taking off or landing, or landed safely after parts — up to and including engines — fell off in-flight, or landed so hard an engine hit the runway and was torn off (must’ve been ex-Navy?)
I’ll begin with a few that didn’t just crash — you can decide for yourself whether these count:
HL7442 (Korean Air Lines) was shot down by a Soviet Su-15 fighter 1983–09–01.
VT-EFO (Air India) apparently exploded over the ocean, 1985–06–23.
N93119 (TWA) exploded, probably due to a short circuit igniting vapor in the fuel tank, 1996–07–17. (TWA Flight 800)
B-18255 (China Airlines) suffered a tail strike on 1980–02–07 and was repaired, but not in accordance with Boeing’s manuals. It apparently disintegrated at high altitude over the ocean, 2002–05–25.
Then there are 22 definite crashes, involving 23 747s — because one crash famously involved a 747 crashing into another 747:
D-ABYB (Lufthansa) crashed 1km after takeoff on 1974–11–20 due to flaps being set wrong.
5–8104 (Iranian Air Force) was struck by lightning, causing a fuel vapor explosion and crash on 1976–05–09.
PH-BUF (KLM) collided with taxiing N736PA (Pan Am) at takeoff speed due to misunderstood tower instructions on 1977–03–27. (Tenerife airport disaster)
VT-EBD (Air India) crashed into the ocean after takeoff after instrument failure led to improper pilot inputs, 1978–01–01.
JA8119 (Japan Air Lines) bounced and hit its tail while landing 1978–02–06. Substantial damage was repaired, but the repaired portion later failed during flight resulting in loss of control and a crash into a hillside on 1985–08–12.
HL7445 (Korean Air Lines) crashed short of the runway and caught fire 1979–03–23.
HK-2910 (Avianca) crashed into a hill in Spain due to poor navigation and miscommunication with approach, 1983–11–27.
ZS-SAS (South African Airways) crashed into the ocean after an in-flight fire, 1987–11–28.
N807FT (Flying Tiger Cargo) crashed into a hill due to misunderstood approach instructions, 1989–02–19.
B-198 (China Airlines Cargo) crashed into a hill while attempting to return to airport after an engine fell off and control was lost, 1991–12–29.
4X-AXG (El Al Cargo) crashed into an apartment tower while attempting to return to airport after two engines fell off and control was lost, 1992–10–04.
HZ-AIH (Saudi Arabian Airlines) crashed after takeoff into an Air Kazakhstan flight that was descending for arrival and had failed to maintain its assigned altitude, 1996–11–12.
HL7468 (Korean Air Lines) crashed into a hill 3.3 miles short of the runway due to pilot error and a software patch to the altitude warning system at the approach control radar center.
HL7451 (Korean Air Cargo) crashed after takeoff due to after instrument failure led to improper pilot inputs, 1999–12–22.
9V-SPK (Singapore Airlines) crashed as it was taking off due to using the wrong runway, which had construction equipment and barriers on it, 2000–10–31.
9G-MKI (MK Airlines Cargo) crashed 700m short of the runway due to failure to follow approach procedures, 2001–11–27.
9G-MKG (MK Airlines Cargo) crashed 100m after takeoff due to takeoff weight being calculated incorrectly, resulting in incorrect thrust and speed settings, 2004–10–14.
N714CK (Kalitta Cargo) lost two engines after takeoff and crashed into a farm, 2008–07–07.
N571UP (UPS Cargo) crashed after an in-flight fire, 2010–09–03.
HL7604 (Asiana Cargo) crashed after an in-flight fire, 2011–07–28.
N949CA (National Air Cargo) crashed after takeoff due to poorly-restrained cargo breaking loose, 2013–04–29.
TC-MCL (ACT/Turkish Cargo) crashed into a slope 930 meters past its destination runway, 2017–01–16.
You’ll notice that it’s been 17 years since a passenger 747 crashed. The airlines that still have them in passenger service are pretty careful nowadays — and cargo has gotten less well-behaved.