We investigate the type of dual superconductivity responsible for quark confinement. For this purpose, we solve the field equations of theU(1) Abelian–Higgs model to obtain the static vortex solution in the whole range without restricting to the long-distance region. Then we use the resulting magnetic field of the vortex to fit the gauge-invariant chromoelectric field connecting a pair of quark and antiquark which was measured by numerical simulations for SU(2) and SU(3) Yang–Mills theories on a lattice. This result improves the accuracy of the fitted value for the Ginzburg–Landau parameter to reconfirm the type I dual superconductivity for quark confinement which was claimed by preceding works based on an approximate method called the Clem fit. Moreover, we calculate the Maxwell stress tensor to obtain the distribution of the force around the flux tube. This suggests that the attractive force acts on the surface perpendicular to the chromoelectric flux tube, in agreement with the type I dual superconductivity