Aims. Solar photospheric footpoint motions can produce strong, localised currents in the corona. A detailed understanding of the formation process and the resulting heating is important in modelling nanoflares, as a mechanism for heating the solar corona. Methods. A 3D MHD simulation is described in which an initially straight magnetic field is sheared in two directions. Grid resolutions up to 512 3 were used and two boundary drivers were considered; one where the boundaries are continuously driven and one where the driving is switched off once a current layer is formed. Results. For both drivers a twisted current layer is formed. After a long time we see that, when the boundary driving has been switched off, the system relaxes towards a lower energy equilibrium. For the driver which continuously shears the magnetic field we see a repeating cycle of strong current structures forming, fragmenting and decreasing in magnitude and then building up again. Realistic coronal temperatures are obtained.