Knoevenagel condensation of barbituric acids with aromatic aldehydes containing one or two formyl groups was carried out. 5-Arylidenebarbituric acids underwent smooth hetero-Diels-Alder (HDA) reactions with enol ethers to afford cis and trans diastereoisomers of pyrano[2,3-d]pyrimidine-2,4-diones and 5,5′-(1,4-phenylene)bis[2H-pyrano[2,3-d]pyrimidine-2,4(3H)-dione] derivatives in excellent yields (75–88 %). Syntheses were realized by Knoevenagel condensation and HDA reaction in four different reaction conditions: Knoevenagel condensation in water and Diels-Alder reaction in methylene chloride solution, Knoevenagel condensation in water and Diels-Alder reaction without solvent, three-component one-pot reaction in methylene chloride solution, or three-component one-pot reaction in water. All reactions were carried out without catalyst at room temperature. The reactions of malononitrile with Knoevenagel condensation products of barbituric acids and heteroaromatic aldehydes or terephthalaldehyde were examined and did not provide corresponding pyranopyrimidines.Graphical Abstract.