Nanoscale modifications of strain and magnetic anisotropy can open pathways to engineering magnetic domains for device applications. A periodic magnetic domain structure can be stabilized in sub-200 nm wide linear as well as curved magnets, embedded within a flat non-ferromagnetic thin film. The nanomagnets are produced within a non-ferromagnetic B2-ordered Fe 60 Al 40 thin film, where local irradiation by a focused ion beam causes the formation of disordered and strongly ferromagnetic regions of A2 Fe 60 Al 40 .An anisotropic lattice relaxation is observed, such that the in-plane lattice parameter is larger when measured parallel to the magnet short-axis as compared to its length. This in-plane structural anisotropy manifests a magnetic anisotropy contribution, generating an easy-axis parallel to the short axis. The competing effect of the strain and shape anisotropies stabilizes a periodic domain pattern in linear as well as spiral nanomagnets, providing a versatile and geometrically controllable path to engineering the strain and thereby the magnetic anisotropy at the nanoscale.