Gross margin
Gross margin is the difference between revenue and cost of goods sold (COGS), divided by revenue. Gross margin is expressed as a percentage. Generally, it is calculated as the selling price of an item, less the cost of goods sold (e.g., production or acquisition costs, not including indirect fixed costs like office expenses, rent, or administrative costs), then divided by the same selling price. "Gross margin" is often used interchangeably with "gross profit", however, the terms are different: "gross profit" is technically an absolute monetary amount and "gross margin" is technically a percentage or ratio. Gross margin is a kind of profit margin, specifically a form of profit divided by net revenue, e.g., gross (profit) margin, operating (profit) margin, net (profit) margin, etc. Purpose 
The purpose of margins is "to determine the value of incremental sales, and to guide pricing and promotion decision." "Margin on sales represents a key factor behind many of the most fundamental business considerations, including budgets and forecasts. All managers should, and generally do, know their approximate business margins. Managers differ widely, however, in the assumptions they use in calculating margins and in the ways they analyze and communicate these important figures." Percentage margins and unit margins
Gross margin can be expressed as a percentage or in total financial terms. If the latter, it can be reported on a per-unit basis or on a per-period basis for a business. "Margin (on sales) is the difference between selling price and cost. This difference is typically expressed either as a percentage of selling price or on a per-unit basis. Managers need to know margins for almost all marketing decisions. Margins represent a key factor in pricing, return on marketing spending, earnings forecasts, and analyses of customer profitability." In a survey of nearly 200 senior marketing managers, 78 percent responded that they found the "margin %" metric very useful while 65 percent found "unit margin" very useful. "A fundamental variation in the way people talk about margins lies in the difference between percentage margins and unit margins on sales. The difference is easy to reconcile, and managers should be able to switch back and forth between the two." Definition of "Unit"
"Every business has its own notion of a 'unit,' ranging from a ton of margarine, to 64 ounces of cola, to a bucket of plaster. Many industries work with multiple units and calculate margin accordingly…  Marketers must be prepared to shift between varying perspectives with little effort because decisions can be rounded in any of these perspectives." Investopedia defines "gross margin" as:

In contrast, "gross profit" is defined as:

or as the ratio of gross profit to revenue, usually as a percentage:

Cost of sales, also denominated "cost of goods sold" (COGS), includes variable costs and fixed costs directly related to the sale, e.g., material costs, labor, supplier profit, shipping-in costs (cost of transporting the product to the point of sale, as opposed to shipping-out costs which are not included in COGS), etc. It excludes indirect fixed costs, e.g., office expenses, rent, and administrative costs. Higher gross margins for a manufacturer indicate greater efficiency in turning raw materials into income. For a retailer it would be the difference between its markup and the wholesale price. Larger gross margins are generally considered ideal for most businesses, with the exception of discount retailers who instead rely on operational efficiency and strategic financing to remain competitive with businesses that have lower margins. Two related metrics are unit margin and margin percent:

"Percentage margins can also be calculated using total sales revenue and total costs. When working with either percentage or unit margins, marketers can perform a simple check by verifying that the individual parts sum to the total." To verify a unit margin ($): Selling price per unit = Unit margin + Cost per Unit
To verify a margin (%): Cost as % of sales = 100% − Margin %

"When considering multiple products with different revenues and costs, we can calculate overall margin (%) on either of two bases: Total revenue and total costs for all products, or the dollar-weighted average of the percentage margins of the different products." Use in sales
Retailers can measure their profit by using two basic methods, namely markup and margin, both of which describe gross profit. Markup expresses profit as a percentage of the cost of the product to the retailer. Margin expresses profit as a percentage of the selling price of the product that the retailer determines. These methods produce different percentages, yet both percentages are valid descriptions of the profit. It is important to specify which method is used when referring to a retailer's profit as a percentage. Some retailers use margins because profits are easily calculated from the total of sales. If margin is 30%, then 30% of the total of sales is the profit. If markup is 30%, the percentage of daily sales that are profit will not be the same percentage. Some retailers use markups because it is easier to calculate a sales price from a cost. If markup is 40%, then sales price will be 40% more than the cost of the item. If margin is 40%, then sales price will not be equal to 40% over cost; in fact, it will be approximately 67% more than the cost of the item. Markup
The equation for calculating the monetary value of gross margin is: 

A simple way to keep markup and gross margin factors straight is to remember that:
 Percent of markup is 100 times the price difference divided by the cost. Percent of gross margin is 100 times the price difference divided by the selling price. Gross margin (as a percentage of revenue)

Most people find it easier to work with gross margin because it directly tells you how much of the sales revenue, or price, is profit:

If an item costs  to produce and is sold for a price of , the price includes a 100% markup which represents a 50% gross margin. Gross margin is just the percentage of the selling price that is profit. In this case, 50% of the price is profit, or . In a more complex example, if an item costs  to produce and is sold for a price of , the price includes a 67% markup ($136) which represents a 40% gross margin. This means that 40% of the  is profit. Again, gross margin is just the direct percentage of profit in the sale price. In accounting, the gross margin refers to sales minus cost of goods sold. It is not necessarily profit as other expenses such as sales, administrative, and financial costs must be deducted. And it means companies are reducing their cost of production or passing their cost to customers. The higher the ratio, all other things being equal, the better for the retailer. Converting between gross margin and markup (gross profit)
Converting markup to gross margin

Examples:
Markup = 100% = 1 
Markup = 66.7% = 0.667 

Converting gross margin to markup

Examples:
Gross margin = 50% = 0.5 
Gross margin = 40% = 0.4 

Using gross margin to calculate selling price

Given the cost of an item, one can compute the selling price required to achieve a specific gross margin. For example, if your product costs $100 and the required gross margin is 40%, then

Gross margin tools to measure retail performance
Some of the tools that are useful in retail analysis are GMROII, GMROS and GMROL. GMROII: Gross Margin Return On Inventory Investment
 GMROS: Gross Margin Return On Space
 GMROL: Gross Margin Return On Labor

Differences between industries
In some industries, like clothing for example, profit margins are expected to be near the 40% mark, as the goods need to be bought from suppliers at a certain rate before they are resold. In other industries such as software product development the gross profit margin can be higher than 80% in many cases. In the agriculture industry, particularly the European Union, Standard Gross Margin is used to assess farm profitability. References

 "Relationship between Markup and Gross Margin"

Accounting terminology
Corporate finance
Financial ratios
Management accounting
Profit