It all starts with a bang. Neutron stars are, as the name implies, composed almost exclusively out of neutrons. And the facts only get cooler (and stranger) from here.
These are a type of stellar remnant that result from supernovae explosions. When particularly massive stars die, there is so much heat and pressure that elements (electrons, protons, and mostly everything) collapse in and are transformed into neutrons.
Hence the name, neutron star.
These stars are amazingly dense and very small (for stars, anyways). Though a neutron star would likely have a diameter of roughly 20-25 km, it would typically have around twice the mass of the sun. For comparison, a marathon is about 42 kilometers. So if you’ve ever ran a marathon, chances you ran farther than the diameter of a neutron star—imagine that, you could have run around an entire star...well, maybe not, as said star has around 333,000 times the mass of our planet and you would be squashed less than flat. In fact, if you attempted this feat, you would vaporize and turn into nothing but a slew of neutrons.
A normal neutron star's primary feature is typically its powerful gravitation field, which is a product of the large mass and small size. But some of these stellar remnants have some unusual properties...
Meet the Magnetar
The Magnetar is a widely accepted variation on a neutron star, and a common explanation for certain phenomena (like soft gamma repeaters and anomalous X-ray pulsars). The magnetar is, at the moment, the most powerful magnetic object known to exist. In fact, the magnetar’s magnetic field is powerful enough that it would be lethal to go anywhere near one (and that's an understatement).
The most powerful magnetic object we have ever been able to make is called a "Halbach sphere." We have been able to make a Halbach sphere that has a magnetic field of 5 Teslas, which is about 100,000 times stronger than the Earth’s magnetic field (using a slightly generous estimate of 50 microteslas for the Earth). A magnetar, on the other hand, can have a magnetic field of up to 10^11 tesla.
So. If we could suddenly make a magnet about a thousand times more powerful, magnetars would still be twenty billion times more powerful than anything we can make. A magnetar's magnetic field may be a quadrillion times stronger than that of the Earth (if you are wondering, that's 1,000,000,000,000,000 times stronger). In fact, it could wipe all of your credit cards clean from 200,000 kilometers away.
Ultimately, magnetars work by sending out extraordinarily powerful bursts of energy, but they don’t keep up such incredible power constantly; however, because they give off so much energy during these bursts, their lifespans are relatively short (around 10,000 years before they decay and are no longer magnetars).
To sum, magnetars live a short but violent life and have the distinction of having the most powerful magnetic fields in the known universe.