Patterned arrays of micron and submicron rectangular Ni81Fe19 elements studied by ferromagnetic resonance (FMR) previously showed that an in-plane shape anisotropy existed in the element, with two origins. One is contributed from a quasiuniform magnetization described by conventional demagnetizing factors, another is an effect of the non-uniform magnetization in the nonellipsoidal element. The results of micromagnetic numerical calculation provide further evidence of the nonuniform demagnetizing field and nonuniform magnetization in the rectangular elements. The calculated profile of demagnetizing field shows that as the aspect ratio increases the non-uniform demagnetizing field decreases, as the data of in-plane FMR require. When the static field is not along either of the edges the demagnetizing field become more nonuniform. Not only its magnitude but also its direction is nonuniform, which causes nonuniform static and microwave field and thus meets the condition for magnetostatic mode excitation as observed by FMR. When the field is along the film normal, the demagnetizing fields at the film edges differ much from the uniform field in the central portion and the magnetization changes gradually across the side. These meet the requirement of dynamic pinning and the excitation of the spin waves with k vector along the narrow side of the elements that was observed by FMR. © 2003 American Institute of Physics.