Cookie dough refers to an un-cooked blend of cookie ingredients. While cookie dough is normally intended to be baked into individual cookies before eating, it is also consumed raw.
Cookie dough can be made at home or bought pre-made in packs (frozen logs, buckets, etc.). Dessert products containing cookie dough include ice cream and candy. In addition, pre-made cookie dough is sold in different flavors.
When made at home, common ingredients include flour, butter, white sugar, salt, vanilla extract, and eggs. If the dough is made with the intention of baking, then leavening agents such as baking soda or baking powder are added. However, these are often excluded in cookie doughs that are designed to be eaten raw. Chocolate chip cookie dough is a popular variation that can be made by adding chocolate chips to the mix.
Cookie dough is derived from the creation of cookies that dates back as far as 7th century Persia, where they were used as test cakes. Persia was one of the first countries to use sugar and soon became known for luxurious cakes and pastries. The early cookie was first labelled as a test cake before it was referred to as a "cookie" because the Persians would bake a small amount of cake batter in the oven to test the oven temperature, and it would come out looking like a mini cake.  The concept of cookies spread and became known worldwide. They evolved into biscuits for convenience as they were easier to keep fresh for a longer period and were simple to carry for travel. 
Cookies became established in Europe sometime between the 17th and 18th century, as baking gained popularity. At that time the word "cookie" was first used. The term comes from the Dutch language where Koekje means "small or little cake". During the ensuing industrial revolution, more cookie recipes became available. New forms and flavors of cookies continue to be created, one of which is the concept of edible cookie dough. Ruth Graves Wakefield and Sue Brides owned the Toll House Inn in Whitman, Massachusetts where they created the eponymous chocolate chip cookie in 1938.
As cookies became more popular and people started baking them at home, people would taste the batter to ensure the sweetness of the product. The practice of eating unbaked dough came later, although it comes with potential health problems.
Because of the presence of raw egg and raw flour, the consumption of uncooked cookie dough increases the possibility of contracting foodborne illness. The U.S. Food and Drug Administration (FDA) strongly discourages the consumption of all food products containing raw eggs or raw flour because of the threat from disease-causing bacteria such as Salmonella and E. coli. Two tablespoons of milk can be swapped for eggs in cookie recipes, and two cups of flour can be microwaved for 50–60 seconds to eliminate bacteria. Leavening, such as baking powder or baking soda, can be removed. Doing so ensures that the cookie dough is safely edible. Cookie dough should be placed in the freezer, but it is considered safe to consume if left out in the open for 2-4 hours. 
Several outbreaks stemmed from pathogens in flour. For example, raw flour was found to be the culprit in a June 2009 E. coli outbreak involving Nestlé Toll House prepackaged cookie dough, which was recalled; more than 7,000 people fell ill, although none died. In 2010, Nestle switched to heat-treated processing for all flour used in producing cookie dough. Heat treatment for flour is a simple treatment to kill bacteria. This treatment involves heating the flour in a 300 °F (149 °C) oven, or heating the flour in a microwave until it gets hot. 
In 2016, General Mills recalled flour and cake mixes because of E. coli in the raw flour. In 2015, certain Blue Bell Ice Cream products were recalled due to Listeria monocytogenes found in the facility that produces chocolate chip cookie dough and other cookie dough containing flavors.
Cookie dough designed specifically for eating raw (such as that found in ice cream) is made without raw eggs and uses heat-treated flour.
Companies offering edible dough include "Nestle Tollhouse Edible Cookie Dough", Do, Edoughable, and The Cookie Dough Café.
Doughp, a Bay Area-founded cookie dough company is experienced a pandemic sales boom despite not getting a deal on ABC's Shark Tank.
Edible cookie dough, egg-free and made with specially treated flour, became a dessert trend and led to the creation of several businesses. Some sweet shops sell multiple desserts with cookie dough as one option, while others solely create and sell dough. 
The "cookie dough" flavor, originating in the United States as comfort food, has gained worldwide recognition.
- Stradley, Linda (28 June 2015). "History of Cookies". What's Cooking America. Retrieved 31 March 2021.
- "The Food Timeline: history notes-- cookies, crackers & biscuits". Food Timeline. Retrieved 2 May 2021.
- Mary Ann Anderson (22 March 2008). "Deceptively delicious egg cocktails". McClatchy-Tribune News Service. Retrieved 8 July 2008.
- Scott, Jenny (June 2016). "Raw Dough's a Raw Deal and Could Make You Sick". Food and Drug Administration.
- "Flour, Raw Dough, and Raw Batter". FoodSafety.gov. Retrieved 29 November 2017.
- "13 Little Known Cookie Dough Facts You Never Knew". DoDo Cookie Dough & Ice Cream. 29 November 2018. Retrieved 4 May 2021.
- "The Surprising Ingredient in Raw Cookie Dough That Could Make You Sick". NPR. Retrieved 29 November 2017.
- Layton, Lyndsey; Gaudio, Greg (30 June 2009). "FDA Confirms Presence of E. coli in Nestle Cookie Dough". The Washington Post. Retrieved 30 April 2010.
- "Nestle to use heat-treated flour in dough". UPI.
- Buiano, Madeline (13 October 2020). "Heat-treating flour is the baking step you're not doing — but should". The Daily Meal. Retrieved 25 April 2021.
- "General Mills: 2016 flour recall consumer Information". Retrieved 29 November 2017.
- "FDA Investigates Listeria monocytogenes in Ice Cream Products from Blue Bell Creameries". Food and Drug Administration. 10 June 2015.
- Hadley Malcolm, Is any cookie dough safe to eat?, USA Today (1 July 2016).
- Kaufman, Joanne (21 June 2017). "Raw Nostalgia: Cookie Dough Is the Latest Dessert Trend". The New York Times. ISSN 0362-4331. Retrieved 31 March 2021.
- Lim, Dion (29 January 2021). "Bay Area-founded 'Doughp' owner goes from sobriety to 'Shark Tank,' sees sales boom amid pandemic". ABC 7 News. ISSN 0891-8775. Retrieved 24 August 2021.
- Kaufman, Joanne (21 June 2017). "Raw Nostalgia: Cookie Dough Is the Latest Dessert Trend". The New York Times. ISSN 0362-4331. Retrieved 23 June 2017.
- "Why Do We Eat Raw Cookie Dough?". Food52. 22 November 2019. Retrieved 31 March 2021.
- Editors, L. C. (11 December 2020). "Americans Are Eating 25% More Cookies. Here's How Your Favorites Stack Up!". Leite's Culinaria. Retrieved 31 March 2021.CS1 maint: extra text: authors list (link)
- Media related to Cookie dough at Wikimedia Commons