CPC is calculated by taking the total amount spent on an ad campaign and dividing it by the total number of clicks. For example, if a campaign cost $100 and generated 50 clicks, the CPC would be $2.