Wonders of Nature Electromagnetism No background needed About 7 min read

How Did We Find Out That Electricity and Magnets Are Connected?
― A Compass Needle Twitched on a Lecture Desk

Today, it is taken for granted that an electric current creates magnetic force. Motors and loudspeakers both work this way. But until about 200 years ago, electricity and magnets were thought to be completely separate things. The wall between them came down thanks to a small compass needle placed beside a wire carrying a current.

Published: 2026.11.03 Difficulty: ★☆☆ (no background needed) Formulas appear only in the fold-out at the end
First, picture this scene

On a mountain walk, you take out a compass to check which way is north. But when you hold it near the phone in your chest pocket or near your headlamp, the needle drifts a little off.

A compass points north because it feels the force of a very large magnet: the Earth. That force is much weaker than you might think. So the needle is easily pulled by a small magnet nearby, or by a wire with electricity running through it.

The first person to confirm that "a wire carrying electricity makes the needle swing" was the Danish physicist Ørsted, in 1820.

The discovery came down to just two keys

1
A steady flow of electricity was finally available

Until then, electricity meant things like the spark of static, gone in an instant. The battery was invented in 1800. Once electricity could keep flowing, the needle at last had time to respond.

2
The direction of the force was not what anyone expected

Magnetic force was thought to either pull or push. But the force from a wire acted in a direction that circles around the wire. People were looking for the wrong direction, so they never found it.

Let's go through them in order.

The needle swings a lot only when it lies parallel to the wire

Ørsted had long believed that electricity and magnetism must be linked somehow. He is said to have been influenced by the idea that the forces of nature are, at root, all connected.

In the spring of 1820, during a university lecture, he held a wire connected to a battery close over a compass. The needle is said to have moved slightly. The battery was weak and the swing was tiny. It is also said that many in the audience did not notice what had happened.

That summer he repeated the experiments in detail. Then, on July 21, he wrote a report of just four pages in Latin and sent it to scholars all over Europe.

What matters is how the wire is placed. Look at Figure 1. The wire runs in the same north–south direction as the needle, right above it. When a current flows, the needle turns toward the east or west. The stronger the current, the bigger the swing.

N S W E Current direction (wire above needle) Sideways field acting on needle Earth's field (north) ≈30 μT Wire's field (west) ≈10 μT Needle swing ≈18° Calculated at a 2 cm distance
Move the slider to change the wire's field and the needle's swing
Figure 1: A compass seen from above, with a wire running north–south directly over it (the thick vertical line; the triangle shows the current's direction). When current flows, the north end of the needle (the pointed tip) swings left, to the west. The two horizontal bars on the right compare the strength of Earth's field and the wire's field. Change the current with the slider, and you can see that the closer the wire's field gets to Earth's, the bigger the needle's swing.

The needle points in the direction of Earth's field and the wire's field combined. Earth's field, in its sideways part near Japan, is said to be about 30 microtesla. A 1-ampere current produces a field about one-third of that, 2 cm away. That alone is enough to make the needle swing clearly.

Conversely, if you lay the wire east–west, the needle hardly moves. This is because the wire's field then lines up exactly north–south. It was an experiment whose result changed depending on which way you tried it.

The force does not "pull" or "push". It goes "around"

Scholars of the time thought of it the same way as with two magnets: the wire would either attract the needle or push it away. Look at Figure 2. The left shows what they expected, and the right shows what really happens.

Expected: pulled to wire All needles point at the wire (dotted) Reality: circles the wire Current toward you Needles follow the circle (blue = field direction)
Figure 2: A cross-section of the wire seen from the side (the circle in the middle; the dot shows current flowing toward you). On the left is what people expected: the surrounding needles all point at the wire. On the right is what really happens: the magnetic field forms circles around the wire, and the needles line up along them.

The magnetic field around a wire draws circles centred on the wire. So the needle does not point at the wire. It lines up along the circle. This "circling force", neither attraction nor repulsion, was a form that physics had never seen before.

The report quickly became a talking point in many places. Ampère in Paris is said to have shown, within weeks of hearing the news, that two wires carrying current attract each other. Research on electric currents and magnetism moved ahead rapidly from there.

💡 The ship struck by lightning, and a compass that pointed the wrong way

Even before Ørsted, records are said to exist of ships struck by lightning after which the compass's north and south were swapped. Lightning is a very strong current that flows for only an instant. Looking back, it was a clue that currents produce magnetism. But because it happened in an instant, no one could trace how it worked.

💡 His name lives on in a unit of magnetic field

An older unit for the strength of a magnetic field is named the "oersted". It is still sometimes used today, for example in figures that describe the performance of magnets.

Summary

The link between electricity and magnetism was found only once batteries made it possible to keep a current flowing. The force did not act in a "pull or push" direction on the wire. It acted in a direction that circles around it. Earth's field is weak, so even a current of about 1 ampere makes a nearby compass swing clearly. When you use a compass in the mountains, it is safest to read it away from your phone and battery-powered gear.

When electricity flows, the force of a magnet appears around it in a ring.
A report of just four pages turned electricity and magnetism into a single field of study.

How a compass needle comes to point north is explained in Why Does a Compass Needle Point North?, and the gap between the needle's north and the map's north is in Why Is Compass North Different from Map North?. For the discovery that led to the battery, see Why Did a Frog's Leg Twitch Just from Touching Metal?. And the story of how Earth's own magnetic field comes from currents flowing inside the planet is in Is It True That Earth's North and South Poles Can Swap?.

🧪 Let's recreate Ørsted's experiment on a desk
  1. Put a compass on a desk and wait for the needle to settle pointing north. Keep phones and iron objects away.
  2. Prepare one AA battery and a wire covered in plastic insulation. Stretch the wire right above the needle, in the same north–south direction as the needle.
  3. Touch the two ends of the wire to the two ends of the battery for just a few seconds. When you see the needle swing east or west, take the wire off right away. If you reverse the battery, the swing goes the other way too.

Connecting a wire straight across a battery lets a large current flow, and both the wire and the battery get hot. Touch them for only a few seconds, and take the wire off as soon as it feels hot. You can also check that if you lay the wire east–west, the needle hardly moves.

For those who want to know more ― terms, formulas, and links to textbooksEach part is labelled with the level it belongs to, from middle-school science to university courses
How to read the labels that follow
  • Middle schoolCovered in middle-school science
  • High schoolCovered in high-school physics
  • High school+Advanced high-school material, or treated as a textbook sidebar
  • UniversityNot taught in high school; university-level electromagnetism
  • ResearchNot taught even at university as settled fact; what researchers are investigating now

Middle schoolTerms: this phenomenon has names

Middle schoolHigh schoolChecking with a formula: how far does the needle swing at 1 ampere?

The strength of the magnetic field around a straight wire is proportional to the current and inversely proportional to the distance from the wire. Let's calculate the needle's swing under the same conditions as Figure 1.

⓪ The underlying formula
In symbolsB = ( μ0 ÷ 2π ) × I ÷ r / needle swing θ: tan θ = B ÷ BE
In wordsWire's field = constant × current ÷ distance. Tangent of the swing = wire's field ÷ Earth's field (sideways part)
Where it comes fromIt follows from Ampère's law (adding up the magnetic field along a circle around the wire gives something proportional to the current passing through it). The needle points along the combined direction of the two fields, so the angle of the swing is set by their ratio.
SymbolMeaning and unit
BStrength of the field made by the wire (microtesla, μT)
ICurrent through the wire (amperes)
rDistance from the wire to the needle (metres)
BESideways component of Earth's field (microtesla)
μ0Permeability of free space. μ0 ÷ 2π comes to 0.2 in microtesla units
① Starting numbers
Constant (μ0 ÷ 2π)Taken to be 0.2 μT・m/A
Current I1 ampere
Wire-to-needle distance r2 cm = 0.02 m
Sideways part of Earth's field (near Japan)About 30 μT
② Let's calculate
Constant × current0.2 × 1 = 0.2
Divide by distance to get the wire's field0.2 ÷ 0.02 = 10 μT
Ratio to Earth's field (tangent)10 ÷ 30 ≒ 0.33
Angle whose tangent is 0.33About 18 degrees
For comparison: the wire's field at 1 m0.2 ÷ 1 = 0.2 μT
Ratio to Earth's field at that distance0.2 ÷ 30 ≒ 0.0067

At a distance of 2 cm, a current of about 1 ampere, which even a dry cell can supply, swings the needle by about 18 degrees. At 1 m, the swing is only about 0.4 degrees, which the eye cannot see. Whether a current affects a needle depends on "how close it is" even more than on "how strong it is". This is why you should use a compass away from electrical appliances.

High schoolHigh school+Currents and magnetic fields, one step further

High schoolIn high-school physics, the field around a straight current is learned as H = I ÷ 2πr (field strength), and the magnetic flux density as B = μ0 × H. The field at the centre of a circular current or a coil can be found in the same way. You also learn that a current feels a force from a magnetic field, and this is how a motor works.

High school+Eleven years after Ørsted's discovery, Faraday found the reverse: electromagnetic induction, in which a changing magnetic field produces a current. Currents make magnetic fields, and changing magnetic fields make currents. With both in hand, the age of generators and transformers began.

UniversityThe Biot–Savart law and Maxwell's equations

In university electromagnetism, you learn the "Biot–Savart law", which adds up the field made by each small piece of a current, and "Ampère's law", which adds up the field along a closed path. Both were put into equation form by French scholars soon after the 1820 discovery. Later, Maxwell added a "displacement current" to Ampère's law, completed Maxwell's equations, and derived that light is an electromagnetic wave.

📖 Derivations and more advanced material: Ampère's law (Wikipedia, in Japanese) / Biot–Savart law (Wikipedia, in Japanese)

ResearchWhat is still not well understood

In other words, what this article says is also "an explanation of what is understood so far". Even the "story" part of the discovery has points that have not been fully settled.

Links to textbooks (by level)

LevelSubject / unitWhere in this article
Middle schoolScience, Year 2: "Current and magnetic field"Concentric magnetic field around a wire, right-hand screw rule
High schoolPhysics: "Magnetic fields made by currents"Formula for the field of a straight current, calculating the needle's swing
High school+Physics: "Electromagnetic induction"Link to Faraday's discovery
UniversityElectromagnetismBiot–Savart law, Ampère's law, Maxwell's equations
ResearchHistory of science, geomagnetism, animal sensesInterpreting how the discovery happened, the source of Earth's field, magnetic sense in living things
―Link to daily lifeWhen using a compass in the mountains, read it away from phones and electrical gear
References and sources
  1. H. C. Ørsted (1820) "Experimenta circa effectum conflictus electrici in acum magneticam" (the four-page paper reporting the discovery)
  2. R. C. Stauffer (1957) "Speculation and Experiment in the Background of Oersted's Discovery of Electromagnetism", Isis 48
  3. Hans Christian Ørsted (Wikipedia, in Japanese)
  4. Kakioka Magnetic Observatory, Japan Meteorological Agency (気象庁 地磁気観測所)
  5. National Astronomical Observatory of Japan (国立天文台), ed., Rika Nenpyo (理科年表; Chronological Scientific Tables), Maruzen Publishing (geomagnetic values)

※This article is a general-audience science explainer. The figures given are rough guides to help you understand how things work. The strength of Earth's field varies with place and time. If you try the experiment of connecting a battery directly to a wire, keep it to a very short time.