A short solenoid that provides field homogeneity with relatively low inductance and low length-to-radius ratio was successfully designed and validated to work in a Halbach array based portable MRI scanner. The optimization is done by applying genetic algorithm and by using Bio-Savart Law as a forward calculation model. The optimized design shows advantages of much higher homogeneity with a practically small length-to-radius ratio compared with a constant-pitch solenoid.