Any magnetic field may be represented by magnetic field lines.
The line through any point along the magnetic field lines is tangent to the magnetic field vector $\vec{B}$ at that point.
Consider an arbitrary surface with magnetic field lines passing through it. You can divide the arbitrary surface into elements of area $dA$.
For each $dA$, we have to determine the component of $\vec{B}$ normal to the surface at the position of that element:
$$B_{\perp} = B\cos{\theta}$$
, where $\theta$ is the angle between $d\vec{A}$ and $\vec{B}$
The magnetic flux through the area will be:
$$\begin{aligned} d\Phi_{B} &= B_{\perp} \, dA \\&= B \cos{\phi} \, dA \\ &= \vec{B}.d\vec{A} \end{aligned}$$
The total magnetic flux through the surface will be:
$$\Phi_{B} = \int \vec{B}.d\vec{A}$$
The SI unit of magnetic flux is weber, Wb.
$$1 \, \text{Wb} = 1 \, \text{T m}^{2}$$
There is no experimental evidence that a single isolated magnetic pole (magnetic monopoles) exists – poles always appear in pairs.
Hence, we will arrive at Gauss’s law for magnetism:
$$\oint \vec{B}.d\vec{A} = 0$$
, which states that the total magnetic flux through a closed surface is always zero.
Next: Magnetic Field Of A Moving Charge