The paper introduces an efficient procedure that allows the design of low cost magnetic antennas with arbitrary shape and extremely reduced dimensions. The technique is mainly analytical, with a simple and fast optimization procedure and it can be applied to any magnetic antenna, even with very complex geometry, e.g., with fractal shape. Simulations have been compared to measurements, proving an excellent agreement. The chosen configuration is implemented in planar geometry, where the transceiver and the matching circuit can be inserted within the antenna perimeter, allowing the realization of compact devices. For this reason, the device can be efficiently proposed for the realization of the terminal unit in wireless sensor networks. A first prototype has been constructed and tested and the results showed an excellent range.