Magnetic field lines can be entirely confined within the core of a toroid, but not within a straight solenoid. Why?

I do not get it.Magnetic field confined in a toroid-does it mean that outside the toroid there is no magnetic field?,but it is{https://commons.wikimedia.org/wiki/File:Magnetic_Vector_Potential_Circular_Toroid.png}.Or is he talking about an ideal toroid with circular coils?
Is it in someway related to magnetic confinement.But in a toroid there is no uneven density of magnetic lines (inside)so that the charge gets reflected?
Some say the answer is this:
Magnetic field lines can be entirely confined within the core of a toroid, because it has no ends.

If field lines were entirely confined between two ends of a straight solenoid, the flux through the cross-section at each end would be non-zero. But the flux of field B through any closed surface must always be zero. For a toroid, this difficulty is absent because it
has no ends.

But,using Amperes circuital law we say that magnetic field outside the toroid is zero,how come the image contradicts this?

1 Answer
May 2, 2018

The magnetic field outside the toroid (ideal one) is zero . That's not the case with solenoid . Magnetic field , unlike electric fields , has to end up where it starts , or in other words , they should form circular loops . In a solenoid (even if it extends infinitely ) , there is some amount of magnetic field outside , but very weak .
That's where toroid kind of wins in containing a field inside it . Inside toroid , the magnetic field forms a perfect loop (no field leaking , yay !) .

Also in the image , it does say B=0 , outside . I think B here , like anywhere else , means intensity of magnetic field . So , yeah , it doesn't seem to contradict , except for those closed loops that are marked with pink , i got no clue as to what they are . They don't seem to be magnetic field lines :)