Between April and September 2017, blood samples were collected from 344 randomly selected dogs older than 1 year in 180 settlements of 19 counties in Hungary. The dogs lived exclusively outdoors, had never travelled and had neither been examined for Dirofilaria infection nor treated against mosquitoes with insecticides or/and filarioid worms with macrocyclic lactones. Dirofilaria infection was examined with a modified Knott's test for microfilariae, DiroCHEK®, for the presence of D. immitis antigen, as well as by multiplex and conventional PCR. Altogether, 77 (22.4%) dogs living in 58 settlements of 17 counties were found to be infected with one or both Dirofilaria species based on the PCR techniques. Twenty-eight (8.1%) and 38 (11.1%) dogs were infected with D. immitis and D. repens, respectively. Coinfections were recorded in 11 samples (3.2%) collected in 11 locations of 8 counties. The results confirmed that both dirofilarioses are endemic in dogs and the eastern areas of the country are hyperendemic for heartworm disease. Temperature showed a significant association with the prevalence of D. immitis (OR 2.41, 95% CI 1.24-4.86, p = 0.012) but not with that of D. repens (OR 1.37, 95% CI 0.78-2.47, p = 0.286). The prevalence of neither D. immitis (OR 0.99, 95% CI 0.98-1.00, p = 0.213) nor D. repens (OR 1.01, 95% CI 0.99-1.01, p = 0.094) showed a significant correlation with precipitation. The number of yearly growing degree days (GDD) based on the lifecycle of Dirofilaria in mosquitoes ranged between 3.73 and 7.57 for the Hungarian districts. The GDD showed a significant positive association with the prevalence of D. immitis (OR 2.38, 95% CI 1.43-4.15, p = 0.001) and a non-significant positive relationship with that of D. repens (OR 1.25, 95% CI 0.83-1.95, p = 0.291).