Magnetic field calculator
Type the data you have for a magnetism problem and the tool computes the rest, with the figure (⊙ out of the page, ⊗ into it), the right-hand rule and every equation solved and substituted: the field made by currents (straight wire, finite segment, circular loop, solenoid, toroid and several parallel wires added as vectors), the motion of a charge in a field (Lorentz force with vectors, circular orbit, helix, velocity selector and mass spectrometer), the force on conductors and between parallel wires, and the torque on a loop and the idea of the DC motor. The detailed PDF solution explains every step and checks it another way.
Theory and worked examples: Magnetic field: Biot–Savart, Ampère and the Lorentz force.
What you can do
- Field of a long wire by Ampère's law, B = μ0I/(2πr), and of a finite segment by Biot–Savart (angles of the ends), with the chart of B versus distance.
- Circular loop on its axis and at its center, solenoid (B = μ0nI, and the true field at the center of a short coil) and toroid (B = μ0NI/(2πr), zero in the hole and outside).
- Superposition: up to six parallel wires with their current and sense; each one's field, the components and the vector sum, with the field lines drawn.
- Lorentz force F = q(E + v × B) with the determinant of the cross product; circular orbit (radius, period and cyclotron frequency, energy in eV, the potential difference that accelerated the particle) and helix (pitch and radius), with the animation.
- Velocity selector (v = E/B) and mass spectrometer: the mass of the ion from the impact point.
- Force on a straight conductor (F = I L B sin θ) and between two parallel wires (attraction or repulsion, F/L = μ0I1I2/(2πd)).
- Torque on a loop (μ = NIA, τ = μB sin θ, U = −μB cos θ) and a DC motor: average torque with a commutator, back emf, power and efficiency.
- Free data in every case (for example B and r to find the current); with extra data it checks that they agree.
Frequently asked questions
What is the magnetic field of a long straight wire?
B = μ0I/(2πr), with μ0 = 4π·10⁻⁷ T·m/A: it falls as 1/r and its lines are circles around the wire, traversed by the right-hand rule. A wire carrying 10 A makes a field of 40 µT 5 cm away.
What is the radius of the orbit of a charge in a magnetic field?
If the velocity is perpendicular to B, the magnetic force is the centripetal force, |q|vB = mv²/r, so r = mv/(|q|B), and the period T = 2πm/(|q|B) does not depend on the speed. A proton at 2·10⁶ m/s in 0.5 T goes round a circle of 41.76 mm every 131.2 ns.
How strongly do two parallel wires attract?
Each one sits in the other's field: F/L = μ0I1I2/(2πd), attractive if the currents run the same way and repulsive if they run opposite ways. Two wires of 10 A 5 cm apart attract with 400 µN per meter.
How is the torque on a current loop computed?
With the magnetic moment μ = NIA: τ = μB sin θ, where θ is the angle between the loop normal and B. A coil of 50 turns, 5 × 10 cm, carrying 2 A has μ = 0.5 A·m²; in a field of 0.3 T at 30° it feels 75 mN·m, which turns it until μ lines up with B.
How is the right-hand rule used?
For the field of a current, the thumb points along the current and the fingers curl in the sense of B. For the force on a positive charge, the fingers go along v and curl toward B: the thumb gives v × B (for a negative charge the force is reversed).
Guide: the magnetic field, where it comes from and the forces it makes
Charges at rest make an electric field; moving charges, that is, currents, also make a magnetic field B, measured in teslas (T). That field in turn pushes moving charges and current-carrying conductors. This guide sums up both halves of the topic, how B is computed and which forces it produces, with the right-hand rule for directions and examples checked in the tool (μ0 = 4π·10⁻⁷ T·m/A).
How directions are drawn: ⊙, ⊗ and the right hand
Many vectors in this topic are perpendicular to the paper. They are drawn as the tip of an arrow coming toward you, ⊙ (out of the page), or as its tail going away, ⊗ (into the page). For the field of a current: the right thumb points along the current and the fingers curl in the sense of the lines of B. For the force on a positive charge: the fingers go along v, curl toward B and the thumb gives v × B; for a negative charge the force is reversed.
The field made by currents
The Biot–Savart law gives the contribution of every piece of current, dB = (μ0/4π)·I·dl × r̂/r², and the total field is the sum. With enough symmetry, Ampère's law, ∮B·dl = μ0·Ienc, gives it in one line:
- Long straight wire: B = μ0I/(2πr), in circles around the wire.
- Finite segment: B = μ0I/(4πd)·(sin θ2 − sin θ1), with the angles of the ends measured from the perpendicular dropped from the point.
- Circular loop, on its axis: B = μ0NIR²/[2(R² + x²)3/2]; at the center, μ0NI/(2R).
- Long solenoid: B = μ0nI inside (n = turns per meter), uniform, and nearly zero outside.
- Toroid: B = μ0NI/(2πr) inside the core; zero in the hole and outside.
- Several wires: each one's field adds as a vector (superposition).
The magnetic forces
F = q·(E + v × B) F = I·L × B F/L = μ0I1I2/(2πd) τ = μ × B, μ = N·I·A
The magnetic force on a charge is perpendicular to its velocity, so it never does work: it changes the direction, not the speed. With v ⟂ B the charge goes round a circle of radius r = mv/(|q|B) with a period T = 2πm/(|q|B) that does not depend on the speed; with an oblique v, the component along B does not change and the path is a helix of pitch p = v∥·T. On a conductor, the force is the sum of those on its charges, F = I·L·B·sin θ. Two parallel wires attract if their currents run the same way. A current loop feels a torque that turns it until its magnetic moment μ lines up with B; that is the idea of the electric motor.
Worked examples
- Wire with 10 A, field 5 cm away. B = (4π·10⁻⁷)·10/(2π·0.05) = 40 µT, about the size of the Earth's magnetic field. Backwards, 100 µT at 2 cm needs 10 A, and with 25 A the field falls to 50 µT at 10 cm.
- Segment of 20 cm with 5 A, point facing the center 5 cm away. sin θ2 − sin θ1 = 2·0.1/√(0.1² + 0.05²) = 1.789 and B = 17.89 µT, 89.44 % of what an infinite wire would give at the same distance (20 µT).
- Flat coil of 50 turns, R = 8 cm and 0.5 A. At the center B0 = 196.3 µT; 15 cm along the axis it falls to 20.46 µT. A single loop of radius 10 cm carrying 2 A gives 12.57 µT at its center.
- Solenoid of 500 turns, 25 cm and 2 A. n = 2000 turns/m and B = (4π·10⁻⁷)·2000·2 = 5.027 mT inside.
- Toroid of 1000 turns carrying 1.5 A, core from 10 to 14 cm. At the mean radius, 12 cm, B = 2.5 mT; at the inner edge 3 mT and at the outer one 2.143 mT.
- Two wires of 10 A in opposite directions, 10 cm apart. At the midpoint each gives 40 µT and both point the same way: 80 µT. Four wires of 5 A at the corners of a 6 cm square, two coming out and two going in on opposite sides, give 66.67 µT at the center.
- Proton at 2·10⁶ m/s in 0.5 T. r = mv/(|q|B) = 41.76 mm and T = 131.2 ns: the cyclotron frequency is 7.623 MHz. An electron accelerated from rest through 1 kV reaches 1.876·10⁷ m/s and in 2 mT goes round a circle of 53.32 mm.
- Electron at 5·10⁶ m/s at 60° to B = 1 mT. v⊥ = 4.330·10⁶ m/s and v∥ = 2.5·10⁶ m/s: a helix of radius 24.62 mm and pitch 89.31 mm, one turn every 35.72 ns.
- Velocity selector with E = 2·10⁴ V/m and B = 0.1 T. Only particles with v = E/B = 2·10⁵ m/s go through undeflected. If they then enter a field of 0.4 T, carbon 12 ions with charge +1 land 124.4 mm from the slit.
- Conductor of 50 cm carrying 5 A in 0.2 T. F = I·L·B = 0.5 N. At 30° to a field of 0.15 T, 40 cm carrying 12 A feel 0.36 N.
- Two parallel wires of 10 A, 5 cm apart. F/L = (4π·10⁻⁷)·10·10/(2π·0.05) = 400 µN/m, attractive if the currents run the same way.
- Coil of 50 turns, 5 × 10 cm, carrying 2 A in 0.3 T, normal at 30° to B. μ = 50·2·0.005 = 0.5 A·m², τ = μ·B·sin 30° = 75 mN·m (the maximum, at 90°, would be 150 mN·m) and U = −μ·B·cos 30° = −129.9 mJ.
- Motor of 100 turns, 0.01 m² and 0.4 T with 3 A at 1500 rpm, coil of 2 Ω. τmax = 1.2 N·m and, with the commutator, τavg = (2/π)·1.2 = 0.7639 N·m; at 157.1 rad/s it gives 120 W. The average back emf is 40 V, the supply must give 40 + 3·2 = 46 V and the efficiency is 86.96 %.
How to use the tool
- In What do you want to compute? choose the topic: field of currents, moving charge, force on currents or torque on a loop; in Problem, the case, and in the selectors, the directions (of the current, of the field, the particle).
- In Data type what you know and leave empty what you are after. Prefixes work:
5cm, 40µ (or 40u) in the B field for 40 µT, 2m for 2 mT, and scientific notation such as 1.6e-19. With extra data, the tool checks that they agree.
- Look at the figure: directions with ⊙ and ⊗, the field, the forces and, for circular motion, the helix and the motor, the animation with ▶. The charts show B versus distance, τ and U versus angle, or the torque over one turn.
- Read the Step by step, with every equation solved and substituted and the reasoning for the directions, and open the Detailed solution (PDF), which also checks every result another way (for example, adding Biot–Savart piece by piece).
Common mistakes
- Forgetting to convert to meters distances in cm: B = μ0I/(2πr) with r = 5 gives a field 100 times smaller than with r = 0.05.
- Using the left hand or swapping the order of the product: v × B is not B × v.
- Not reversing the force for a negative charge (electrons): it turns the other way.
- Adding the sizes of the fields of several wires: they add as vectors.
- Taking θ as the angle with the plane of the loop in τ = μB sin θ: it is the angle between the normal (μ) and B.
- Thinking the magnetic field speeds the charge up: it only deflects it; its speed and kinetic energy do not change.
Further reading
The chapters on the magnetic field, sources of the magnetic field and Ampère's law in any university physics textbook. In Simuveliq, electromagnetic induction follows with what happens when the flux of B changes (Faraday and Lenz, generators, inductances), and electric charges and Gauss's law treat the electric field with the same ideas of superposition and symmetry.
More tools
Versión en español
About Simuveliq · How we verify the calculations · Terms of use · Privacy policy · Contact