Calculate target price for margin from product cost
This target margin price calculator works backward from product cost and the profit margin you want to retain.
Run — free
Enter the cost of one item and a target margin percentage to find the minimum selling price at your chosen decimal precision. The calculation treats margin as profit divided by selling price, which differs from markup divided by cost. It also reports profit per item and the margin achieved after practical price rounding, making the result useful for catalogs, quotes, and automated pricing rules.
Turn a margin goal into a selling price
Pricing from a target margin starts with the relationship among cost, revenue, and profit. Profit is selling price minus cost, while profit margin is that profit divided by selling price. Solving this relationship for price gives cost divided by one minus the target margin expressed as a decimal. A margin percentage should not simply be added to cost. That shortcut calculates markup, and markup and margin describe different bases. This calculator applies the margin formula directly, then reports the required selling price, profit per item, and achieved margin. Use the same currency for cost and price; the arithmetic works identically for dollars, euros, pounds, or another currency. Enter the complete landed cost when possible, including expenses that the selling price must recover. If freight, packaging, or predictable transaction expenses are left out, the result can satisfy the mathematical target on the entered cost while the business retains less profit than intended. The output is therefore only as complete as the cost supplied.
Understand upward price rounding
A calculated target price often contains more decimal places than a store can display or charge. Ordinary nearest rounding may lower that price and leave the realized margin slightly below the requested target. This calculator instead rounds the required price upward at the selected precision. With two decimal places, the result is the smallest cent-level price that does not undershoot the goal. The achieved margin is calculated again from the rounded selling price, allowing you to see the small difference introduced by practical pricing precision. Choose zero decimals for whole-unit prices, two for common currency pricing, or additional decimals when a wholesale contract, marketplace, or high-volume unit model supports them. Upward rounding protects the requested margin, but it does not automatically model psychological endings, coupons, taxes, commissions, or payment fees. Include predictable per-item expenses in cost before calculating, or assess them separately afterward. That keeps the returned price useful as a defensible floor while leaving room for commercial decisions such as competitive positioning, promotional strategy, and preferred price endings.
Use the price safely in a workflow
Treat the target price as a minimum based on the supplied inputs, not as a guarantee of overall business profitability. Confirm that product cost follows the inventory valuation method your team uses and that the requested percentage is truly a margin rather than a markup. A target margin must remain below 100 percent because the formula divides cost by the portion of selling price left after margin. At exactly 100 percent that portion is zero, so a positive-cost item would require an infinite price. Above 100 percent, no positive finite selling price can satisfy the request. The calculator rejects both cases explicitly. It also rejects zero and negative costs because margin-based target pricing does not give a unique useful answer for free, subsidized, or credit-generating inventory. After receiving a valid result, compare it with competitive prices, minimum advertised price rules, taxes, discounts, and channel fees. For automation, call the same deterministic calculation for each product at $0.002 per request and route the stable result fields into review queues, reports, or controlled catalog update processes.
What you can do with it
Set a new retail price
Convert landed unit cost and a merchandising margin goal into a minimum chargeable selling price.
Review supplier cost changes
Recalculate price floors after cost increases and find catalog prices that no longer protect the target margin.
Build channel-specific floors
Include each channel's predictable expenses in cost, then calculate a defensible minimum price for that channel.
FAQ
What formula is used?
Price equals cost divided by one minus the target margin expressed as a decimal.
Is margin the same as markup?
No. Margin divides profit by selling price, while markup divides profit by cost.
Why does the price round upward?
Upward rounding ensures the displayed price still achieves at least the requested margin.
Why is 100 percent rejected?
A positive-cost item would require an infinite price at 100 percent margin.
Should cost include fees?
Include every predictable per-item expense that the selling price must recover.
What does the API calculation cost?
Each request costs $0.002; browser calculation is free.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/ecom/product-margin-target-price \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"cost":40,"target_margin_percent":20}'const res = await fetch("https://api.kit.forhosting.com/ecom/product-margin-target-price", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"cost": 40,
"target_margin_percent": 20
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/ecom/product-margin-target-price",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"cost": 40,
"target_margin_percent": 20
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/ecom/product-margin-target-price", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"cost":40,"target_margin_percent":20}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"cost":40,"target_margin_percent":20}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/ecom/product-margin-target-price", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"cost": 40,
"target_margin_percent": 20
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "ecom.product_margin_target_price",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |