ELI5: How do magnets work?

Let's cover electric fields and electricity first.

Atoms are made up of two parts: the nucleus in the middle and the electrons that "orbit around" the nucleus. The nucleus is made up of protons (positively-charged particles) and neutrons (particles with no charge). That comes into play later.

According to Quantum Field Theory, everything around us is the result of fields interacting with each other. A field is just a three-dimensional "thing." It could be invisible, or it could reflect light. It could be solid, or you could walk right through it, or it could distort your movement as you do so. These fields can interact with each other in complicated or simple ways.

A field can be "programmed" to attract certain kinds of objects and repel other kinds of objects. That's how an electric field works. Every particle that has a "charge" causes a three-dimensional sink in the electric field all around it. Imagine how gravity gets stronger and stronger the closer you get to a planet... well, the electric field (positive or negative) will get stronger and stronger the closer you get to the object. Put another way, objects with charge "distort" the electric field just like objects with a lot of mass will "distort" the gravitational field.

Different charges attract. Opposite charges repel. In other words, a proton, which is positive, will "try" to pull an electron, which is negative, into it, and thus the electron will be attracted to the proton. The reason why the electron doesn't stick to the proton is because electrons are weird as hell: that has nothing to do with the fact that different charges attract, but it means that the electrons will basically form orbitals around the nucleus, which creates an atom of matter.

A normal atom has equal numbers of electrons and protons: that balances out the negative and positive charges so the atom itself doesn't have a net charge either way. However, if you remove a few of the electrons, that atom becomes what we call a "positively charged ion." It will try to grab electrons off of other atoms that get near... but then that might create another ion once the second atom loses some electrons. If you set things up just right, you can make it so this happens to one atom... two atoms... three atoms...

On and on and on, so there's a long line of positive and negative charge being exchanged. The "negative charge" (electrons) end up moving in one direction. The "positive charge" (lack of electrons) can be said to be moving in the other direction. And when electrons are moving over a distance, this creates a noticeable magnetic field.

The magnetic field has a north pole and a south pole, and we describe those things as "negative" and "positive," but they have NOTHING to do with attracting or repulsing positively or negatively charged objects like protons and electrons: just the two poles of other magnetic objects. The same rule applies, however: like poles of magnets will repulse, and unlike poles of magnets will attract. And the magnetic fields themselves are created by moving electrons inside a substance.

Artificially, noticeable magnetic fields are created when electrons move through a wire. But there are also magnetic fields created inside your refrigerator magnets, because they have the same domino effect of moving electric charges inside them on a much, much smaller scale. In fact, metals like iron are like that all the time: the only problem is that, in nature, iron is comprised of many tiny little magnetic parts facing in different ways that end up canceling each other out. However, if you have a strong enough magnet and hold iron up to it, those tiny little "magnetic domains" inside the iron will re-arrange themselves so they all orient in one direction and supplement each other to create a bigger magnetic field. Now you've "magnetized" the iron.

/r/explainlikeimfive Thread