In the title molecule, C7H7N3O, the pyrimidine ring is essentially planar, with the propynyl group rotated out of this plane by 15.31 (4)°. In the crystal, a tri-periodic network is formed by N—H...O, N—H...N and C—H...O hydrogen-bonding and slipped π–π stacking interactions, leading to narrow channels extending parallel to the c axis. Hirshfeld surface analysis of the crystal structure reveals that the most important contributions for the crystal packing are from H...H (36.2%), H...C/C...H (20.9%), H...O/O...H (17.8%) and H...N/N...H (12.2%) interactions, showing that hydrogen-bonding and van der Waals interactions are the dominant interactions in the crystal packing. Evaluation of the electrostatic, dispersion and total energy frameworks indicates that the stabilization is dominated by the electrostatic energy contributions. The molecular structure optimized by density functional theory (DFT) calculations at the B3LYP/6–311 G(d,p) level is compared with the experimentally determined structure in the solid state. The HOMO–LUMO behaviour was also elucidated to determine the energy gap.