Tokamaks are traditionally viewed as axisymmetric devices. However this is not always true, for example in the presence of saturated instabilities, error fields, or resonant magnetic perturbations (RMPs) applied for edge localized mode (ELM) control. We use the VMEC code (Hirshman and Whitson 1983 Phys. Fluids 26 3553) to calculate three dimensional equilibria by energy minimization for tokamak plasmas. MAST free boundary equilibria have been calculated with profiles for plasma pressure and current derived from two dimensional reconstruction. It is well known that ELMs will need to be controlled in ITER to prevent damage that may limit the lifetime of the machine (Loarte et al 2003 Plasma Phys. Control. Fusion 45 1549). ELM control has been demonstrated on several tokamaks including MAST (Kirk et al 2013 Nucl. Fusion 53 043007). However the application of RMPs causes the plasma to gain a displacement or corrugation (Liu et al 2011 Nucl. Fusion 51 083002). Previous work has shown that the phase and size of these corrugations is in agreement with experiment (Chapman et al 2012 Plasma Phys. Control. Fusion 54 105013). The interaction of these corrugations with the plasma control system (PCS) may cause high heat loads at certain toroidal locations if care is not taken (Chapman et al 2014 Plasma Phys. Control. Fusion 56 075004). VMEC assumes nested flux surfaces but this assumption has been relaxed in other stellarator codes. These codes allow equilibria where magnetic islands and stochastic regions can form. We show some initial results using the HINT2 code (Suzuki et al 2006 Nucl. Fusion 46 L19). The Mercier stability of VMEC equilibria with RMPs applied is calculated. The geodesic curvature contribution can be strongly influenced by helical Pfirsch–Schluter currents driven by the applied RMPs. ELM mitigation is not fully understood but one of the factors that influences peeling-ballooning stability, which is linked to ELMs, is a three dimensional corrugation of the plasma edge (Chapman et al 2013 Phys. Plasmas 20 056101). The infinite n ideal ballooning stability of the equilibria with and without the RMPs applied has been calculated using the COBRA code (Sanchez et al 2000 J. Comput. Phys. 161 576–88). When RMPs are applied, the most unstable ballooning mode growth rate is increased.