Magnetic current imaging is deemed an emerging powerful technique for visualizing electrical currents in electronic devices. However, the existing magnetic-field-based Fourier Transform back-evolution method is limited by its mono-function of imaging the magnitude of current density in devices under test, and subject to background noise distortion. Here, we developed a novel vectorial current density imaging method based on the detection of the magnetic field gradient generated by current carrying conductors. A closed form solution of current density inversion was analytically derived and numerically verified. Experiments were conducted by scanning tri-axial fluxgate sensor over different shapes of electrical wires. The results show that a current density resolution of 24.15 mA/mm2, probe-to-sample separation of 2 mm, and spatial resolution of 0.69 mm were achieved over a maximum scanning area of 300 mm × 300 mm. Such a method is verified to be capable of simultaneously imaging both magnitude and directions of current density, which is a promising technique for in situ noninvasive inspection for the power electronic and semiconductor industry.