Permanent magnets are a critical component of electric motors and generators in a broad spectrum of applications. The rapid growth of the wind power and electromobility sectors has resulted in a greatly increased demand for highest performance Nd-Fe-B-based permanent magnets. Limited global resources of rare earth elements recquire the development of reduced or rare-earth-free permanent magnets. The aim of this project is to produce a digital twin of rare earth-free MnAl-C permanent magnets. This requires a complete, quantitative description of the microstructure in three dimensions and detailed knowledge of the role of the different components of the microstructure in determining the magnetic properties. This information forms the basis for micromagnetic simulations of the magnetic properties based on realistic, simulated microstructures. The digital twin is evaluated by simulating the magnetic state of the material after exposure to a specific magnetic field history and comparing the results with the experiment. Machine learning is used to establish the relationship between experiment and simulation and to generate a realistic model of MnAl-C magnets. Creating the digital twin of a permanent magnet delivers important contributions to the digitalisation of materials science, environmental sustainability, clean energy and electromobility.