You can make a magnetic field by running electric current through a wire. Every current-carrying wire produces a magnetic field around it, and by coiling that wire and adding a metal core, you can concentrate that field into something strong enough to pick up objects, power motors, or run scientific experiments. The simplest version takes about five minutes to build with a battery, a nail, and some copper wire.
Why Electric Current Creates a Magnetic Field
Whenever electrons flow through a conductor, they generate a magnetic field that forms concentric circles around the wire. The field lines wrap around the wire perpendicular to the direction of current flow. You can predict the direction using the right-hand rule: point your thumb in the direction current is flowing, and your fingers curl in the direction the magnetic field wraps around the wire.
A single straight wire produces a relatively weak field. The key to making a useful magnetic field is coiling that wire into loops. Each loop’s field stacks on top of the next, and the combined effect creates a much stronger, more focused field through the center of the coil. This is the basic principle behind every electromagnet, from a science fair project to an MRI machine.
Building a Simple Electromagnet
The easiest way to make a magnetic field at home is to wrap insulated copper wire around an iron nail and connect it to a battery. Here’s what you need:
- An iron or steel nail, at least 3 inches (7.6 cm) long. Aluminum won’t work because it isn’t ferromagnetic.
- Insulated copper wire, about 2 feet (0.6 m) of AWG 22 gauge or thinner.
- A D-cell battery (1.5 volts).
- Small metal objects to test it, like paperclips, tacks, or pins.
Strip about half an inch of insulation from each end of the wire. Wrap the wire tightly around the nail in neat, close rows, leaving enough unwrapped wire at each end to reach the battery terminals. The more turns you wrap, the stronger the field. Touch one bare wire end to the positive terminal and the other to the negative terminal, and the nail becomes a magnet that can pick up paperclips.
The nail matters because iron is ferromagnetic. When the coil’s magnetic field passes through it, the iron’s internal magnetic domains align with the field, amplifying it dramatically. A coil of wire with no core (an “air core”) produces a field, but adding an iron core can multiply the field strength by hundreds or even thousands of times. High-performance nanocrystalline core materials can have an initial permeability of 100,000, meaning they concentrate magnetic flux far beyond what air alone allows.
Making the Field Stronger
Three variables control how strong your magnetic field gets: the number of wire turns, the amount of current flowing through them, and what’s inside the coil.
The formula for the field inside a solenoid (a cylindrical coil) is straightforward: magnetic field equals the permeability of the core material, multiplied by the number of turns per unit length, multiplied by the current. Double the turns and you double the field. Double the current and you double the field again. In practical terms, this means you can strengthen your electromagnet by wrapping more wire, using a larger battery (or multiple batteries in series), or switching to a better core material.
There are limits, though. Pushing more current through thin wire generates heat. A 22-gauge copper wire (0.645 mm diameter) will fuse at around 41.5 amps, but it gets dangerously hot well before that point. For a simple battery-powered electromagnet, this isn’t a concern since a D-cell can only deliver a few amps. But if you’re designing something more powerful with a bench power supply, use thicker wire. A 14-gauge wire handles significantly more current before overheating, with a fusing point around 166 amps.
Creating a Uniform Magnetic Field
A single coil or solenoid produces a field that’s strongest in the center and weaker toward the edges. For experiments that need a consistent field across a larger area, you need a different setup called a Helmholtz coil. This uses two identical coils placed parallel to each other, separated by a specific distance. For square coils, that spacing is 0.5445 times the coil’s side length. For circular coils, the spacing equals the radius.
When both coils carry the same current in the same direction, the fields overlap in the middle region to create a nearly uniform zone. The field strength at the center depends on the coil size, number of turns, and current. Helmholtz coils are commonly used in physics labs to calibrate instruments, cancel out Earth’s magnetic field, or test how devices respond to controlled magnetic environments. If you need even better uniformity, four-coil designs exist that extend the uniform zone by adding smaller auxiliary coils at calculated positions.
Permanent Magnets vs. Electromagnets
Electromagnets produce a field only while current flows, which makes them adjustable and easy to turn off. Permanent magnets hold their field indefinitely without any power source. Both create real magnetic fields, but through different mechanisms.
Permanent magnets like the neodymium magnets on your fridge are manufactured by melting a mixture of neodymium, iron, and boron, casting it into ingots, then grinding those ingots into a fine powder. The powder is pressed into shape and sintered (heated until it fuses without fully melting). The final step is magnetization: the sintered block is placed inside an extremely strong external magnetic field that aligns all the material’s magnetic domains in one direction. Once aligned, the domains in these hard magnetic materials stay locked in place, and the object remains magnetic on its own.
You can’t easily make a permanent magnet at home from scratch, but you can partially magnetize a steel needle by stroking it repeatedly in one direction with an existing magnet. This aligns some of the needle’s magnetic domains. The result is weak compared to a manufactured magnet, but strong enough to make a compass needle.
Extremely Strong Fields
Ordinary electromagnets hit a ceiling because copper wire has electrical resistance, which generates waste heat that limits how much current you can push through. Superconducting magnets solve this by using special wire cooled to temperatures near absolute zero, where electrical resistance drops to zero and current flows without generating heat.
Most superconducting magnets are cooled with liquid helium at around 4.5 Kelvin (about minus 269°C). At this temperature, certain alloys become superconducting and can carry enormous currents indefinitely. The Large Hadron Collider at CERN uses superconducting magnets cooled by liquid helium channels running through the magnet structure. MRI machines in hospitals use the same technology to generate fields typically between 1.5 and 3 Tesla, thousands of times stronger than a refrigerator magnet.
These systems are expensive and complex, requiring sophisticated cooling infrastructure. But for applications that need fields above about 2 Tesla sustained over long periods, superconducting coils are the only practical option. The magnets themselves still follow the same basic principle as your nail-and-battery electromagnet: current flowing through a coil, generating a field proportional to the turns and the current. The superconductor just removes the heat problem that limits ordinary wire.

