The felicific calculus is an algorithm formulated by utilitarian philosopher Jeremy Bentham for calculating the degree or amount of pleasure that a specific action is likely to cause. Bentham, an ethical hedonist, believed the moral rightness or wrongness of an action to be a function of the amount of pleasure or pain that it produced. The felicific calculus could, in principle at least, determine the moral status of any considered act. The algorithm is also known as the utility calculus, the hedonistic calculus and the hedonic calculus.
Variables, or vectors, of the pleasures and pains included in this calculation, which Bentham called "elements" or "dimensions", were:
- Intensity: How strong is the pleasure?
- Duration: How long will the pleasure last?
- Certainty or uncertainty: How likely or unlikely is it that the pleasure will occur?
- Propinquity or remoteness: How soon will the pleasure occur?
- Fecundity: The probability that the action will be followed by sensations of the same kind.
- Purity: The probability that it will not be followed by sensations of the opposite kind.
- Extent: How many people will be affected?
Bentham's instructions 
- Begin with any one person of those whose interests seem most immediately to be affected by it: and take an account,
- Of the value of each distinguishable pleasure which appears to be produced by it in the first instance.
- Of the value of each pain which appears to be produced by it in the first instance.
- Of the value of each pleasure which appears to be produced by it after the first. This constitutes the fecundity of the first pleasure and the impurity of the first pain.
- Of the value of each pain which appears to be produced by it after the first. This constitutes the fecundity of the first pain, and the impurity of the first pleasure.
- Sum up all the values of all the pleasures on the one side, and those of all the pains on the other. The balance, if it be on the side of pleasure, will give the good tendency of the act upon the whole, with respect to the interests of that individual person; if on the side of pain, the bad tendency of it upon the whole.
- Take an account of the number of persons whose interests appear to be concerned; and repeat the above process with respect to each. Sum up the numbers expressive of the degrees of good tendency, which the act has, with respect to each individual, in regard to whom the tendency of it is good upon the whole. Do this again with respect to each individual, in regard to whom the tendency of it is bad upon the whole. Take the balance which if on the side of pleasure, will give the general good tendency of the act, with respect to the total number or community of individuals concerned; if on the side of pain, the general evil tendency, with respect to the same community.
To make his proposal easier to remember, Bentham devised what he called a "mnemonic doggerel" (also referred to as "memoriter verses"), which synthesized "the whole fabric of morals and legislation":
Intense, long, certain, speedy, fruitful, pure—
Such marks in pleasures and in pains endure.
Such pleasures seek if private be thy end:
If it be public, wide let them extend
Such pains avoid, whichever be thy view:
If pains must come, let them extend to few.
Hedons and dolors 
The units of measurements used in the felicific calculus may be termed hedons and dolors. They may be regarded as similar to the utilitarian posends and negends.
See also