Compare material use, machining time and tooling cost.
Cold forging forms a blank at or near room temperature, then machining brings selected features to size. Machining from solid starts with stock and cuts the part directly. Which route costs less depends on the part, its material and how many you expect to order.

A near-net blank and a machined pin. Illustrative rendering; not to scale.
Lower material use. Upsetting and extrusion form heads, steps and hollow sections by moving metal. This can save material on parts that would otherwise need a lot of turning or milling. Piercing and finish machining still produce scrap. Cold-forming process
Fewer roughing cuts. A blank close to the finished shape leaves less stock to remove. Sealing faces, precision bores and other critical features can then be machined to the drawing. Either route can meet the specified final tolerances. Secondary operations
Work hardening. Cold forming can increase hardness and strength, but later heat treatment may change these properties. Check the finished part against the material specification. A cold-forged part is not automatically stronger than one machined from qualified bar stock. FIA design guide
A Ø20 × 5 mm head with a Ø10 × 35 mm shank retains only 34.4% of a Ø20 × 40 mm solid blank’s volume. Machining removes the other 65.6%. Cold heading can form the larger head by upsetting a smaller-diameter blank.
Idealized geometry; excludes allowances and cutoff loss. These percentages describe the solid-machining route, not a guaranteed cold-forging saving.

Small batches allow changes to holes and shoulders before production. Illustrative rendering.
Machining is often the practical choice for samples, small batches and parts still being revised. Standard stock also avoids waiting for dedicated forging dies.
Check formability before ordering dies. The material must withstand the required deformation, and the part must release from the die. Low ductility, high die loads or radial undercuts may require extra stages or make machining the better option. Cold-forging design considerations

Tooling cost is spread across repeat production. Illustrative rendering.
Start with the extra tooling and approval cost. Divide it by the saving on each accepted part to estimate how many parts you need to recover that investment.
Extra fixed cost ÷ net saving per accepted part
$30,000 ÷ $3 = 10,000 parts
Example only, not a quotation. Here, $30,000 is the extra cost of tooling and process approval compared with machining from solid.
Include material, scrap value, forming, machining, replacement tools, heat treatment, inspection and rejects in both unit costs. Base the volume on orders you expect before the next design change. If forging does not reduce the unit cost, more volume will not recover the extra tooling cost.
To compare quotes, send the drawing, material condition, critical tolerances, order quantity and expected total demand. Ask for both routes to be quoted against the same inspection and acceptance requirements.