The gross profit P is the difference between the cost to make a product C and the selling price or revenue R.
P = R - C
To calculate revenue R based on the cost C and the desired gross margin G, where G is in decimal form:
R = C / ( 1 - G)
The gross profit dollars P is the revenue dollars R from the sale times the gross margin G percentage, where G is in decimal form :
P = R * G
The markup percentage M, in decimal form, is gross profit P divided by cost C.
M = P/ C
M * 100 will change the decimal to a percentage.