The purpose of this paper is to derive the on and off-axes magnetic field of a solenoid with the use of a novel method. We have found a solution for the Biot-Savart law by considering the solenoid with a stationary electric current. The results have been compared to numerical simulations showing a good agreement.