Heterocyclic aromatic amines (HCAs) and polycyclic aromatic hydrocarbons (PAHs) as carcinogenic chemical compounds can be formed during high-temperature heating of beef patties. The current study was aimed to evaluate the effects of nutmeg and ginger essential oils incorporated in two concentrations (0.02 and 0.04%) and their nanoemulsions on the HCAs and PAHs formation in grilled beef patties during production time, 45- and 90-days storage in a freezing condition at − 18 °C. According to results, the HCAs and PAHs levels in essential oil and nanoemulsion added grilled beef patties significantly decreased while compared to the control. The addition of 0.04% nutmeg oil nanoemulsion in grilled beef patties led to the highest reduction in 2-amino-3,4-dimethyl-imidazo[4,5-f] quinoline (100% reduction) and benzo [b] fluorantene (46% reduction). The storage time of beef patties significantly affected the concentration of HCAs and PAHs. In this context, with increase in storage time, the levels of HCAs and PAHs were decreased and increased, respectively. The formation of 2-amino-3,4-dimethyl-imidazo[4,5-f] quinoline in all grilled beef patties containing nutmeg oil and its nanoemulsion was reduced by 100% after 45 and 90 days storage. However, the lowest increase in the formation of PAHs was related to dibenzo [a,h] anthracene by 25% in grilled beef patties containing 0.04% nutmeg oil nanoemulsion at the end of storage time. Generally speaking, nutmeg oil and especially prepared nanoemulsion have a great impact in preventing of the carcinogens compound formation in grilled patties.