The DIY Electromagnet: Building a Switchable Magnet from Wire and a Nail
Share
Can You Really Make a Magnet That Turns On and Off?
Yes, and it's surprisingly simple. By wrapping insulated copper wire around an iron nail and connecting it to a battery, you can create a functional electromagnet that attracts metal objects when powered and releases them the moment you disconnect the circuit. Unlike permanent magnets, electromagnets give you control: flip the switch (or touch the wire to the battery), and you've got magnetic pull. Break the connection, and the attraction vanishes. This 4β7 minute build is a hands-on introduction to electromagnetism, the invisible force that powers everything from doorbells to MRI machines.
What Makes This Experiment So Powerful?
This isn't just about sticking a nail to a battery. When you wrap wire into tight coils around an iron core and run current through it, you're building a solenoid, a device that converts electrical energy into a magnetic field. The iron nail amplifies that field hundreds of times stronger than the wire alone could produce. Kids (and adults) get an instant, tactile understanding of how electricity and magnetism are two sides of the same coin, and why Michael Faraday's 1831 discovery of electromagnetic induction changed the world.
Materials You'll Need (and What They'll Cost)

Here's your shopping list. Most of these items can be sourced from a hardware store, online supplier, or your garage:
| Material | Quantity | Estimated Cost | Where to Find It |
|---|---|---|---|
| Iron nail (3β4 inches) | 1 | $0.50β$1.00 | Hardware store, toolbox |
| Insulated copper wire (22β26 gauge) | 3β6 feet | $2.00β$5.00 | Hardware store, craft supplier |
| D-cell battery (1.5V) | 1 | $1.00β$2.00 | Grocery, hardware store |
| Battery holder (optional) | 1 | $1.50β$3.00 | Electronics supplier |
| Alligator clips (2) | 2 | $1.00β$2.00 | Electronics supplier, online |
| Wire strippers | 1 | $5.00β$10.00 | Hardware store (or use scissors) |
| Electrical tape | 1 roll | $1.00β$2.00 | Hardware store |
| Paper clips or small nails | 5β10 (for testing) | Free (scrounge) | Office drawer, toolbox |
Total estimated cost: $12.00β$27.00 (less if you have wire and tools on hand).
Substitutions: A 6V lantern battery or 9V battery can be used for stronger magnetic pull, but the wire may heat up faster. A steel bolt can substitute for the nail. Thinner wire (higher gauge) packs more coils into less space, which can increase field strength, but it also heats up more quickly.
Step-by-Step: Building Your Electromagnet
Step 1: Prep Your Wire (30 seconds)
Strip about 2 inches of insulation from both ends of your copper wire using wire strippers or carefully with scissors. You need bare copper exposed to make solid contact with the battery terminals. Leave the middle section of wire fully insulated, this is what you'll wrap around the nail.
Step 2: Start the Coil (1 minute)
Hold the nail horizontally. Leave a 4β6 inch "tail" of bare wire hanging loose at one end (this becomes your first battery connection). Begin wrapping the insulated portion of the wire tightly around the nail, starting near the head and moving toward the point. Keep the coils close together, side-by-side, without overlapping. The direction doesn't matter much for a basic electromagnet, but consistency does, wrap in one direction (clockwise or counterclockwise) throughout.
Step 3: Build Layers (2β3 minutes)
Keep wrapping until you've covered most of the nail's length. You can go back and add a second or third layer on top of the first, which concentrates more coils in the same space and strengthens the magnetic field. Aim for at least 50 tight turns. The more coils you pack on, the stronger your magnet, but don't stress about counting.
When you reach the end, leave another 4β6 inch tail of bare wire. Use a small piece of electrical tape on each end of the coil to keep the windings from unraveling.
Step 4: Connect to the Battery (30 seconds)

Attach one bare wire end to the positive terminal of your battery and the other to the negative terminal. If you're using alligator clips, clamp one clip to each wire tail, then clip the other end to the battery terminals. If you're working directly, you can tape or hold the wires in place. The moment both wires touch the battery, your electromagnet is live.
Step 5: Test the Magnetic Pull (1 minute)
Hold the nail near a paper clip, staple, or small nail. It should jump toward the electromagnet and stick. Try picking up multiple clips at once. Now disconnect one wire from the battery, the clips should drop immediately. Reconnect, and they stick again. That's switchable magnetism in action.
The Science Behind the Magic: How Electromagnetism Works
Current Creates a Magnetic Field
When electrons flow through a wire, they generate a weak magnetic field around the wire. In a straight wire, this field is circular and faint. But when you coil the wire into a solenoid, the individual magnetic fields from each loop stack up and reinforce one another, creating a much stronger, concentrated field along the axis of the coil. The nail sits right in the middle of this field.
The Iron Amplifies Everything
Iron is a ferromagnetic material, meaning its atoms contain tiny magnetic regions called domains that normally point in random directions, canceling each other out. When you place iron inside a solenoid's magnetic field, the field aligns these domains so they point the same way. The iron becomes magnetized and amplifies the solenoid's field by a factor of hundreds or thousands. Remove the current, and the domains relax back to randomness, the magnetism disappears (mostly; some iron retains a faint residual field).
Why the Wire Gets Warm
Copper wire has low resistance, but it's not zero. As current flows, some electrical energy converts to heat due to collisions between electrons and copper atoms. The thinner the wire and the higher the current, the more heat builds up. A single D-cell doesn't produce dangerous heat in this setup, but a 9V battery with thin wire can get uncomfortably warm after 30β60 seconds of continuous use. This is why short tests and quick on-off cycles are safer than leaving the circuit closed.
Magnetic Field Strength and Coil Density
The strength of your electromagnet depends on three main factors:
- Number of coils (N): More turns = stronger field.
- Current (I): Higher voltage or lower resistance = more current = stronger field.
- Core material: Iron beats copper, which beats air. Steel works too, though pure iron is magnetically "softer" and responds faster.
The magnetic field strength inside a solenoid is proportional to N Γ I, which is why layering coils and using a fresh battery both help.
Troubleshooting Common Issues
The electromagnet doesn't pick up anything: Check that both wire ends are making solid contact with the battery terminals. Verify the wire is tightly coiled (loose coils reduce field strength). Test with a known ferromagnetic object like a steel paper clip, not aluminum or brass.
The wire gets too hot to touch: Disconnect immediately. Use a lower-voltage battery (1.5V instead of 9V), thicker wire (lower gauge number), or limit on-time to 10β15 seconds per test. Consider using a momentary push-button switch instead of holding the connection.
Magnetism is weak: Add more coils, use a fresh battery, or try a larger iron nail. Ensure the coils are tight and evenly spaced. A rusty or painted nail can reduce performance, sand the surface if possible.
The nail stays slightly magnetic after disconnecting: This is normal for some iron or steel. The material retains a small residual field. Tap the nail gently or reverse the current direction briefly to demagnetize it.
Ways to Experiment Further
- Test different core materials: Try a steel bolt, a copper rod, a wooden dowel, or no core at all (just the coil). Measure how many paper clips each version can lift.
- Vary the coil count: Wind 25 turns, then 50, then 100. Graph the lifting power.
- Reverse polarity: Flip the battery connections. The nail's magnetic poles switch, the end that was "north" becomes "south." Use a compass to detect this.
- Build a simple switch: Add a paperclip switch or push-button to control the circuit without disconnecting wires by hand.
- Create an electromagnet scale: Suspend the electromagnet above a bowl and see how many grams of paper clips it can lift before they drop.
Real-World Applications of Electromagnets

Electromagnets are everywhere in modern technology:
- Electric motors and generators: Spinning electromagnets convert electrical energy to motion (motors) or motion to electricity (generators).
- Maglev trains: Powerful electromagnets levitate trains above tracks, eliminating friction.
- MRI machines: Superconducting electromagnets generate fields tens of thousands of times stronger than Earth's, imaging soft tissues inside the body.
- Speakers and headphones: A coil attached to a diaphragm vibrates in response to audio signals, creating sound waves.
- Doorbells and relays: A small electromagnet pulls a metal striker or switch when the button is pressed.
- Scrapyard cranes: Industrial electromagnets lift and move tons of scrap metal with the flip of a switch.
Frequently Asked Questions
Can I use a rechargeable battery?
Yes. NiMH or lithium rechargeable cells work fine. Just monitor for heat if using higher-capacity packs.
Why does polarity matter for the magnetic poles but not for basic function?
The electromagnet works regardless of which wire connects to which terminal, but flipping the battery reverses the north and south poles of the nail. For lifting paper clips, polarity doesn't matter. For experiments with compasses or motor-building, it does.
How long can I leave the circuit connected?
With a single D-cell and moderate wire gauge, brief tests (15β30 seconds) are safe. Longer durations drain the battery and risk overheating. Use intermittent testing rather than continuous operation.
Can I make a stronger electromagnet with household items?
Yes. Use thicker iron (a larger bolt), more coils, or multiple batteries in series (which increases voltage). Just watch for heat buildup and don't exceed safe handling temperatures.
What's the difference between an electromagnet and a solenoid?
A solenoid is a coil of wire. An electromagnet is a solenoid with a ferromagnetic core (like iron) that amplifies the magnetic field. The terms are often used interchangeably in casual conversation.
Why does iron work better than other metals?
Iron has a high magnetic permeability, meaning it concentrates magnetic field lines efficiently. Aluminum, copper, and brass are non-ferromagnetic and won't amplify the field.
Teaching Tips for Families and Classrooms
- Start with a weak battery (1.5V) for younger kids to minimize heat risk. Older students can graduate to 6V or 9V under supervision.
- Use this as a springboard to discuss motors, generators, and Faraday's law. Show how the electromagnet is the core component of electric drills, fans, and hard drives.
- Pair this with a compass experiment: Place a compass near the energized coil and watch the needle deflect, proving the invisible magnetic field exists.
- Document results: Have students count coils, measure lifting capacity, and graph the relationship. This turns a demo into a quantitative science investigation.
- Connect to history: Mention that William Sturgeon built the first practical electromagnet in 1825, and Joseph Henry improved it in 1830 by insulating wire, allowing many more turns without short-circuits.
Why This Experiment Belongs in Every DIY Toolkit
Building an electromagnet bridges the gap between "electricity" and "magnetism," two phenomena that seem separate until you see them interact. This project gives you a working model of the physics behind motors, generators, speakers, and relays: all in a single nail and a few feet of wire. It's tactile, immediate, and endlessly tweakable. You can test variables, compare results, and watch a lifeless hunk of iron come alive with invisible force the instant you close the circuit. For middle schoolers exploring electromagnetism or older students designing their first motor, this is the foundation.
And here's the real magic: you're holding a device that's conceptually identical to the electromagnets that levitate 600-ton trains or peer inside the human brain. The scale changes, but the science is the same. That's the power of hands-on learning: making the invisible visible, one paper clip at a time.
Safety Disclaimer:
This experiment involves electrical circuits and can generate heat. Copper wire may become warm or hot during prolonged use, especially with higher-voltage batteries or thin-gauge wire. Disconnect the circuit immediately if the wire feels uncomfortably warm. Use batteries rated at 9V or below. Do not use wall current or power supplies not designed for low-voltage DC experiments. Work on a non-flammable surface and keep water away from the circuit. Adult supervision is recommended for children under 10. Always handle batteries and electrical components with care. Tierney Family Farms and its contributors are not responsible for injuries, property damage, or other outcomes resulting from the use or misuse of this information. Conduct this experiment at your own risk and follow appropriate safety practices for your age and experience level.