Kant arrives at the categorical imperative by asking what kind of law could determine a will that is genuinely good. Such a law cannot be drawn from experience or from what we happen to desire — that would make morality merely conditional. It must instead be purely formal: a principle of acting only on maxims that one could consistently will to be universal laws of nature.
The test is not empirical but logical. When you consider an action, formulate the maxim behind it — the principle on which you are acting — and ask: could I consistently will that everyone act on this maxim? A false promise to repay a debt fails this test. If universalised, the institution of promising would collapse, making the maxim self-defeating. The contradiction reveals the action's wrongness without any appeal to consequences.
Kant offers several formulations of the categorical imperative throughout the Groundwork — the formula of universal law, the formula of humanity, and the formula of the kingdom of ends. He maintains these are all expressions of the same underlying principle, each illuminating a different facet: the form a maxim must take, the matter it must respect, and the complete determination of all maxims under self-given legislation.
The categorical imperative is formulated in the Second Section of the Groundwork, where Kant also tests it against four examples involving duties to oneself and to others.



