In the title compound, 2C3H7N6
+·C4H4O6
2−·2H2O, in which the complete anion is generated by crystallographic twofold symmetry, there are O—H⋯O, N—H⋯O and N—H⋯N hydrogen-bonding interactions between neighbouring moieties, forming layers parallel to the bc plane. In addition, π–π contacts [centroid–centroid distance = 3.6541 (9) Å] between the six-membered rings of the melamine cations are observed.