Magnetic Field Lines

Draw the magnetic field lines around bar magnets, a horseshoe magnet or a set of magnets, and print them as a poster or a worksheet. The tool uses a simple idealised model: each end of a magnet is a point pole, N or S, and the field at any point is the sum of the poles’ fields, each falling off with the square of the distance. Every line is traced step by step along the field from the N poles, with arrows from N to S, and stops where it reaches an S pole, a magnet or the edge of the page; lines that come in from the edge to an S pole are traced too. Show the lines, an iron-filings look, compass needles on a grid, or just the magnets for students to draw their own. Magnets print at the size you type. Download a PDF, a 300 DPI PNG or an SVG. Nothing is uploaded.

100% private — everything runs in your browser. Everything runs in your browser; nothing is uploaded.

100% private — runs in your browser

Print at 100% (Actual size): magnets print at the size you type and the field fills the page. The SVG holds every field line as a path.

Magnets

Look

Page

Runs in your browser with our own code: nothing you type is uploaded or saved. Every line, filing and needle is worked out from the pole model by our own code. You may use what you make here, including commercially, with no credit needed.

How to draw and print magnetic field lines

  1. Pick a preset, or choose an arrangement of magnets.
  2. Type the magnet length, width and gap, and turn the set if you like.
  3. Choose field lines, filings, both, compass needles or magnets only.
  4. Set the number of lines per pole and the colours.
  5. Download the PDF and print at 100% (Actual size), or the PNG or SVG.

What you can use it for

  • Science worksheets: draw the field around a magnet
  • Answer sheets and posters for magnetism lessons
  • Comparing attracting and repelling magnets
  • Diagrams for notes, slides and revision cards
  • Plotter and laser art from the SVG lines
  • Pattern ideas from the flowing lines

The 17 presets

PresetMagnetGapLookLines drawnLines ending at an S pole or magnetLines reaching the page edge
One bar magnet: field lines with arrows60 × 16 mm30 mmfield lines26620
One bar magnet: 32 lines per pole60 × 16 mm30 mmfield lines541044
One bar magnet: iron-filings look60 × 16 mm30 mmiron-filings look (1,800)–––
One bar magnet: compass needles60 × 16 mm30 mmcompass needles (404)–––
Two bars attracting (N facing S)60 × 16 mm30 mmfield lines461828
Two bars repelling (N facing N)60 × 16 mm30 mmfield lines521240
Two bars repelling: iron-filings look60 × 16 mm30 mmiron-filings look (1,800)–––
Two bars side by side, same way60 × 16 mm40 mmfield lines58652
Two bars side by side, opposite ways60 × 16 mm30 mmfield lines442024
Horseshoe magnet70 × 16 mm30 mmfield lines23914
Horseshoe magnet: lines and filings70 × 16 mm30 mmlines + filings (1,800)23914
Four bars around a square (quadrupole)40 × 12 mm50 mmfield lines804832
Three bars in a row40 × 16 mm16 mmfield lines462620
Two bars in a T50 × 16 mm10 mmfield lines411427
Short bar inside a circle (planet-style picture)80 × 16 mm30 mmfield lines281216
Worksheet: one bar and compass needles, no lines60 × 16 mm30 mmcompass needles (150)–––
Worksheet: two bars only (draw the lines yourself)60 × 16 mm30 mmmagnets only–––

Line counts are worked out by the tool from the lines it traces, on US Letter.

One bar magnet: lines per pole

Lines per N poleLines drawnN pole to S poleN pole to the page edgePage edge to S pole
46222
814266
1220488
162661010
244081616
3254102222
4880163232

Lines from the N pole spread over the half facing out of the magnet; the outer ones leave the page, and the same number come back in to the S pole from the edge.

How the model works

PartIn this tool
PolesOne point pole at the middle of each end face: N = +1, S = −1
FieldSum over the poles of (r − rᵢ) / |r − rᵢ|³, so each pole’s field falls off with the distance squared
TracingFourth-order Runge–Kutta steps of 0.4 mm along the field direction, from 1.5 mm out of each N pole
A line stopsWithin 1.5 mm of an S pole, at a magnet’s outline, at the page edge, or where the field is zero
Not modelledThe inside of a magnet, its material, field strength in tesla

What prints

DownloadWhat is in it
PDFThe field filling the page, magnets at the size you type, vector, with the settings and a check bar
PNG 300 DPIThe same sheet as a picture
SVGEvery field line, filing and needle as a path, and the magnets, at the printed size

For a cutter that needs DXF, use SVG to DXF.

Which tool to use

You wantUse
Field lines around magnets, a filings look or a worksheetMagnetic Field Lines (this page)
A grid to draw your own diagram onGraph Paper
To edit the lines by handSVG Path Editor

Other tools: Graph Paper prints grids, and the SVG Path Editor edits any line from the SVG.

More free tools

Curves, patterns and printables?

Drawing and print tools that run privately in your browser, with no sign-up and no watermark.

See all free tools →

Frequently asked questions

What are magnetic field lines?

They are drawn lines that show which way a magnetic field points: at every point a line runs along the field, the way a small compass needle would point. Compass needles point away from a magnet’s north pole and towards its south pole, so outside a magnet the lines run from N to S. The lines are a way to draw the field; the field itself has no separate lines.

How does the tool draw them?

Each magnet end is a point pole of strength +1 (N) or −1 (S). The field at a point is the sum over all poles of the direction away from the pole divided by the distance squared. Each line starts 1.5 mm from an N pole and is traced in 0.4 mm steps with the fourth-order Runge–Kutta method along the field direction. In our tests every step is within 0.01 radian of the field direction, and for one bar magnet the lines match the exact two-pole solution to one part in a million.

Why do the lines never cross?

At any point the field has only one direction, so two lines can only meet where the field is zero or at a pole. Our tests check every pair of lines on every preset for crossings away from the poles and find none.

What happens inside the magnet?

Magnetic field lines have no ends: they form closed loops, so each line that reaches an S pole carries on through the magnet. The pole model on this page does not describe the inside of a magnet, so nothing is drawn there; each line stops at the outline.

Is it what iron filings really show?

Iron filings line up with the field, which is what the filings look draws: short dashes turned along the field at scattered points. Real filings also bunch into separate strands, because the iron itself changes the field around it, so a photo looks streakier than this even scatter.

Is this a measurement of a real magnet?

No. It is an idealised model for drawing and teaching. A real magnet’s field depends on its material, shape and how it was magnetised, so its lines can sit in different places. The tool does not work out a field strength in tesla.

What do the compass needles show?

Each needle is turned along the field at its point on an even grid, with the red tip pointing the way the field points, the way a small compass would settle near the magnets.

Is it free?

Yes. There is no sign-up, no watermark and no limit.

Is anything uploaded?

No. Every point, line and filing is worked out by JavaScript in your browser. Nothing you type is sent anywhere or saved when you close the page.