When the weather heats up, keeping food cool at a shindig can be a difficult task.

TikTok user Shannon McNitt has gone viral for sharing a low-cost hack that keeps food chilled for an extended period.

McNitt’s viral video involves two aluminum pans, one that is filled with water a third of the way and gets placed in a freezer. When the pan’s water is completely frozen, the second aluminum pan can be placed on top before serving food.

TIKTOK HACK FOR DIY LAZY SUSAN MADE WITH HOUSEHOLD ITEMS PRAISED AS 'REVOLUTIONARY'

In McNitt’s example, cherry tomatoes and sliced-up carrots, cucumbers and cheese were served. 

"Keeps food fresh while sitting out," McNitt captioned the video along with hashtags like #entertaining, #foodsafety and #freshfood.

Since its original posting in April, the video has garnered more than 12.7 million views, 1 million likes and thousands of comments.

‘JARCUTERIE’ FOOD TREND PUTS SPIN ON CHARCUTERIE BOARDS

"Ok I’m literally kicking myself for not ever thinking of this," one TikTok user replied.

"Wow wish I thought of this 20 parties ago," another user chimed in.

Some commenters said McNitt’s hack would fare better if she used salt water or ice cubes in place of a frozen water sheet.

TIKTOK'S 'TWISTED BACON' TREND SUPPOSEDLY MAKES THE 'CRISPIEST AND CHEWIEST' BACON

McNitt conducted a three-part experiment that tested the longevity of her original hack versus the salt water and ice cubes.

"After four hours, the water with salt is almost completely liquid. The regular water has almost a full sheet of ice. And the ice cubes are almost completely dissolved," McNitt explained in her second video. "So in the end, my ice hack is still the winner."

CLICK HERE TO GET THE FOX NEWS APP

@livingonlife101

Viral food hack experiment #experiment ##foodhack ##viral

♬ Baby Work It - Your Favourite Garçon 

According to the U.S. Food and Drug Administration, certain food items need to remain cool to "prevent bacterial growth." This includes fresh produce, meat, poultry and seafood. The optimum temperature to store these foods at a gathering is 40 °F or below. 

CLICK HERE TO SIGN UP FOR OUR LIFESTYLE NEWSLETTER

Traditional coolers are recommended by the FDA, but it is not uncommon for event planners and catering teams to use ice baths to keep temperature-sensitive food cold. The U.S. Department of Agriculture says ice baths are "great option for keeping cold items cold at a party."