In this work, the problem of coil design is studied. It is assumed that the structure of the coil is known (i.e., the positions of simple circular coils are fixed) and the problem is to find current distribution to obtain the required magnetic field in a given region. The unconstrained version of the problem (arbitrary currents are allowed) can be formulated as a Least-SQuares (LSQ) problem. However, the results obtained by solving the LSQ problem are usually useless from the application point of view. Moreover, for higher dimensions the problem is ill-conditioned. To overcome these difficulties, a regularization term is sometimes added to the cost function, in order to make the solution smoother. The regularization technique, however, produces suboptimal solutions. In this work, we propose to solve the problem under study using the constrained Quadratic Programming (QP) method. The methods are compared in terms of the quality of the magnetic field obtained, and the power of the designed coil. Several 1D and 2D examples are considered. It is shown that for the same value of the maximum current the QP method provides solutions with a higher quality magnetic field than the regularization method.