Home / Learn / Physics / Magnetic field mapperTool #L18 (formerly #1043)

Magnetic field lines of a bar magnet, a wire, a loop and a solenoid, with a compass you can drag

See the magnetic field lines of a bar magnet, a straight current-carrying wire, a circular loop and a solenoid. Drag a compass around to see which way its needle points and how strong the field is there, and learn the right-hand thumb rule. Class 12 level adds B = μ₀I/2πr, μ₀NI/2a and μ₀nI with your numbers.

Keep it one tap away for everyday use.

Bookmark Magnetic field mapper?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Pick source
  2. Field lines
  3. Drag compass
  4. Check
Nothing is uploadedWorks offline once open

Pick a magnet or a current

north end of the needlearrows: direction of the field⊙ current out of the screen, ⊗ into it

Drag the compass, or tap anywhere to move it there. The picture is 20 cm across; the Earth's own field is left out.

Which way do the lines go?

Try this

  • Drag the compass right round the bar magnet. The needle turns twice as you go once round.
  • With the straight wire, move the compass further away: the field gets weaker, and the circles get further apart.
  • Reverse the current. Every arrow and the compass needle swing round.
  • Compare the loop and the solenoid with the bar magnet: the solenoid's field outside looks just like the magnet's.
  • Put the compass inside the solenoid and change the number of turns: more turns, stronger field, and it is almost the same everywhere inside.

Check yourself

What it does

A magnetic field cannot be seen, but a compass needle shows which way it points and iron filings show its pattern. This page draws the field lines for four sources and gives you a compass to drag around:

  • a bar magnet, with lines leaving the north pole and curving round to the south pole;
  • a long straight wire carrying a current, with circles round it;
  • a single circular loop (or a flat coil of several turns), seen edge-on;
  • a solenoid, a long coil whose field inside is strong and almost uniform, and whose field outside looks like a bar magnet’s.

Arrows on the lines show the direction of the field. The compass needle (north end in red) lines up with the field wherever you put it, and the page tells you which way it points and how strong the field is there. A short panel explains the right-hand thumb rule for the setup on screen.

It follows the Class 10 Science topics on the magnetic effects of electric current (field lines, the field round a wire, a loop and a solenoid, the right-hand thumb rule) and the Class 12 Physics topics on moving charges and magnetism and on magnetism and matter (Biot-Savart and Ampère’s laws, the current loop as a magnetic dipole, Gauss’s law for magnetism). Before this, see how current flows with the ohm's law lab; for real coil design, the coil field designer takes it further, and the field lines does the same job for electric charges.

How to use it

  1. Pick a level. Class 12 adds the formula with your numbers and a line of deeper explanation.
  2. Pick the source: bar magnet, straight wire, loop or solenoid.
  3. For the wire, loop and solenoid, slide the current (0.5 to 10 A) and, for the loop and solenoid, pick the number of turns.
  4. Tap Reverse the current (or Flip the magnet): every arrow and the compass swing round.
  5. Drag the compass, or tap anywhere on the picture to move it there. On a keyboard, focus the picture and use the arrow keys.

The picture is 20 cm across with the source in the middle. The loop has a radius of 4 cm, the solenoid is 12 cm long and 5 cm across, and the magnet is 8 cm long. The Earth’s own field is left out so you only see the field of the source.

Worked example

Pick the straight wire with 5 A flowing out of the screen. The compass starts 6 cm to the right and 4.5 cm up, which is 7.5 cm from the wire. At Class 12 level the page shows B = μ₀I/(2πr) = 4π × 10⁻⁷ × 5 / (2π × 0.075) = 13.3 µT, and the needle points up and to the left (127°), at right angles to the line from the wire, going anticlockwise as the right-hand thumb rule says.

Now pick the loop with 10 turns and 5 A. The field at the centre is μ₀NI/(2a) = 4π × 10⁻⁷ × 10 × 5 / 0.08 = 785 µT. For the 200-turn solenoid with 5 A, the long-solenoid formula μ₀nI gives 10.5 mT; because this solenoid is short and fat, the exact value in its middle is a little lower, 9.67 mT.

Tips

  • Field lines never cross: at any point the field has only one direction.
  • Where the lines crowd together the field is strong; where they spread out it is weak.
  • A solenoid with a current is an electromagnet: its right-hand end is north when the current goes anticlockwise as you look at that end.

FAQ

Why does the bar magnet look like a solenoid? The page treats the magnet as a short, fat solenoid. Outside, that gives the same field as a magnet; inside, it shows the lines running from S back to N, so every line is a closed loop.

How strong is the bar magnet? It is a made-up teaching magnet, so its field values are only a guide.

Is anything saved? No. Everything is worked out on this page and nothing leaves your device.

Where the numbers come from

  • Field of a long straight wire B = μ₀I/(2πr), of a circular loop from the Biot-Savart law (exact form with complete elliptic integrals, as in standard electromagnetism texts), of a solenoid as a stack of loops, and a bar magnet modelled as a short solenoid (same field outside): standard physics results.
  • μ₀ = 1.25663706127 × 10⁻⁶ N/A² (CODATA 2022 recommended value).
  • Checked against an independent NumPy script that adds up the Biot-Savart field of 200,000 short pieces of the loop, the textbook loop-centre value μ₀NI/2a, and the published values K(0.5) = 1.85407 and E(0.5) = 1.35064.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Change log for Magnetic field mapper

  1. Add #1043 Magnetic field mapper Details on GitHub

Every change to fibub

Related tools

Field lines #T644 Place point charges, line charges and dipoles, drag them around, and watch the field lines and equipotentials redraw. Tap anywhere to read the field strength, direction and potential there, and see the force on every charge. Coil field designer #T645 Design Helmholtz, Maxwell, anti-Helmholtz or your own set of round coils. Get the exact field at the centre, how long and how wide the uniform region is, a map of the uniformity, the current for a target field, and the wire length, resistance and heat. Magnetic circuit solver #T649 Describe a core as segments of iron or ferrite and air gaps, in one loop or as a three-leg core, and get the reluctance of each part, the flux and flux density everywhere, the inductance, the stored energy, the pull across a gap and the current needed for a target gap field. Ohm's law lab #L16 A virtual circuit for Ohm's law. Slide the battery voltage, read the ammeter and voltmeter, record readings and plot V against I. The slope is the resistance. Compare a resistor with a filament bulb, and work out a wire's resistance from its length, thickness and metal. Fleming's rule #L19 Turn a 3D picture of a wire between magnet poles and see the field, current and force arrows of Fleming's left-hand rule. Change the field, current, length and angle and watch F = BIL sin θ. Then watch a DC motor coil turn, with and without its split-ring commutator. Faraday induction #L20 Push a bar magnet into a coil and pull it out, and watch the galvanometer swing and the emf graph. See why only a changing flux makes a current, which way the current flows (Lenz's law), and how an AC generator coil makes a sine-wave emf, with its peak and rms values. Electromagnet builder #L24 Make an electromagnet from a coil of wire, some cells and an iron nail. Change the number of turns and cells, take the nail out, switch it off or turn the cells round, and watch three compasses swing and paper clips get picked up or dropped. Lorentz motion #L262 Fire a proton, electron, alpha particle or deuteron into a magnetic field and watch it circle or spiral, with its radius, period and pitch. Add an electric field at right angles to make a velocity selector, or spin it up in a cyclotron and see its frequency, final energy and number of turns. Biot–Savart lab #L263 Add up the magnetic field of a straight wire, a circular loop or a solenoid from small pieces of current, as the Biot–Savart law says, and compare with the exact formula. Graph the field along the axis. Then drag a loop among three long wires and see Ampère's law: the total of B round the loop is μ₀ times the current inside. Magnetic materials #L264 Put a diamagnetic, paramagnetic or ferromagnetic sample in a field and watch its tiny magnets: induced moments against the field, jiggling dipoles that line up a little, or whole domains that flip. Change the temperature, see Curie's law and the Curie temperature, and trace a hysteresis loop with its remanence and coercivity.