We obtain necessary and sufficient conditions for a supersymmetric field configuration in the N = (1, 0) U(1) or SU(2) gauged supergravities in six dimensions, and impose the field equations on this general ansatz. It is found that any supersymmetric solution is associated with an structure. The structure is characterized by a null Killing vector which induces a natural 2 + 4 split of the six-dimensional spacetime. A suitable combination of the field equations implies that the scalar curvature of the four-dimensional Riemannian part, referred to as the base, obeys a second-order differential equation; surprisingly, for a large class of solutions the equation in the SU(2) theory requires the vanishing of the Weyl anomaly of N = 4 SYM on the base. Bosonic fluxes introduce torsion terms that deform the structure away from a covariantly constant one. The most general structure can be classified into terms of its intrinsic torsion. For a large class of solutions the gauge field strengths admit a simple geometrical interpretation: in the U(1) theory the base is Kähler, and the gauge field strength is the Ricci form; in the SU(2) theory, the gauge field strengths are identified with the curvatures of the left-hand spin bundle of the base. We employ our general ansatz to construct new solutions; we show that the U(1) theory admits a symmetric Cahen–Wallach4 × S2 solution together with a compactifying pp-wave. The SU(2) theory admits a black string, whose near horizon limit is AdS3 × S3, which is supported by a self-dual 3-form flux and a meron on the S3. In the limit of the zero 3-form flux we obtain the Yang–Mills analogue of the Salam–Sezgin solution of the U(1) theory, namely R1,2 × S3. Finally we obtain the additional constraints implied by enhanced supersymmetry, and discuss Penrose limits in the theories.