In most English-speaking countries except for the US and Canada, crisp cookies are called biscuits. Chewier biscuits are sometimes called cookies even in the UK. Some cookies may also be named by their shape, such as date squares or bars.

Cookies appear to have their origins in 7th century AD Persia, shortly after the use of sugar became relatively common in the region. They spread to Europe through the Muslim conquest of Spain. By the 14th century, they were common in all levels of society throughout Europe, from royal cuisine to street vendors.

With global travel becoming widespread at that time, cookies made a natural travel companion, a modernized equivalent of the travel cakes used throughout history. One of the most popular early cookies, which traveled especially well and became known on every continent by similar names, was the Jumble, a relatively hard cookie made largely from nuts, sweetener, and water.

Cookies came to America through the Dutch in New Amsterdam in the late 1620s. The Dutch word "koekje" was Anglicized to "cookie" or cooky. The earliest reference to cookies in America is in 1703, when "The Dutch in New York provided...'in 1703...at funeral 800 cookies...'"

The most common modern cookie, given its style by the creaming of butter and sugar, was not common until the 18th century.

Cookies are most commonly baked until crisp or just long enough that they remain soft, but some kinds of cookies are not baked at all. Cookies are made in a wide variety of styles, using an array of ingredients including sugars, spices, chocolate, butter, peanut butter, nuts, or dried fruits. The softness of the cookie may depend on how long it is baked.

A general theory of cookies may be formulated this way. Despite its descent from cakes and other sweetened breads, the cookie in almost all its forms has abandoned water as a medium for cohesion.

Cookie-like hard wafers have existed for as long as baking is documented, in part because they deal with travel very well, but they were usually not sweet enough to be considered cookies by modern standards.

A cookie is a baked or cooked good that is small, flat and sweet. It usually contains flour, sugar and some type of oil or fat. It may include other ingredients such as raisins, oats, chocolate chips, nuts, etc. Cookies are broadly classified according to how they are formed, including at least these categories: 

Bar cookies consist of batter or other ingredients that are poured or pressed into a pan (sometimes in multiple layers) and cut into cookie-sized pieces after baking. In British English, bar cookies are known as "tray bakes."  Examples include brownies, fruit squares, and bars such as date squares.

Drop cookies are made from a relatively soft dough that is dropped by spoonfuls onto the baking sheet. During baking, the mounds of dough spread and flatten. Chocolate chip cookies, oatmeal (or oatmeal raisin) cookies, and rock cakes are popular examples of drop cookies. This may also include thumbprint cookies, for which a small central depression is created with a thumb or small spoon before baking to contain a filling, such as jam or a chocolate chip.

Filled cookies are made from a rolled cookie dough filled with a fruit or confectionery filling before baking. Hamantash are filled cookies.

Molded cookies are also made from a stiffer dough that is molded into balls or cookie shapes by hand before baking. Snickerdoodles and peanut butter cookies are examples of molded cookies. Some cookies, such as hermits or biscotti, are molded into large flattened loaves that are later cut into smaller cookies.

No-bake cookies are made by mixing a filler, such as cereal or nuts, into a melted confectionery binder, shaping into cookies or bars, and allowing them to cool or harden. Oatmeal clusters and Rum balls are no-bake cookies.

Pressed cookies are made from a soft dough that is extruded from a cookie press into various decorative shapes before baking. Spritzgebäck are an example of a pressed cookie.

Refrigerator cookies (also known as icebox cookies) are made from a stiff dough that is refrigerated to make the raw dough even stiffer before cutting and baking. The dough is typically shaped into cylinders which are sliced into round cookies before baking. Pinwheel cookies and those made by Pillsbury are representative.

Rolled cookies are made from a stiffer dough that is rolled out and cut into shapes with a cookie cutter. Gingerbread men are an example.

Sandwich cookies are rolled or pressed cookies that are assembled as a sandwich with a sweet filling. Fillings include marshmallow, jam, and icing. The Oreo cookie, made of two chocolate cookies with a vanilla icing filling, is an example.

Cookies also may be decorated with an icing, especially chocolate, and closely resemble a type of confectionery.