The objective of the magnet design for MRI is first to ensure the field intensity and homogeneity in the central imaging area, and meanwhile to minimize the magnetic leakage of the stray field. Based on this, an optimal design method of 14T actively shielded MRI magnets is proposed in this paper. Firstly the current carrying region of the magnets is subdivided into two-dimensional array grids, in which each grid represents one actual conductor. Then the initial rectangular current distribution is obtained using linear programming in the grid region by a detailed consideration of the superconductor’s consumption, field intensity, imaging region homogeneity and stray field leakage range. The method of particle swarm optimization (pso) is adopted to optimize the final rectangular section of magnet with the limitation of the coil position and section size. In addition, target point sampling and spherical harmonic series elimination are proposed as two optimization strategies and are also compared to find the best design scheme. Finally the total length of this magnet design by four sets of coils is around 3.5m, and the inner diameter is nearly 1m. The detailed optimization design is presented in this paper.