Kant's ethics in a nutshell
We might do good things because it gives reward or avoids punishment -- "hypothetical imperative."
But sometimes we do things because we rationally know "its the right thing to do" -- the "categorical imperative" -- that, says Kant, is the only moral act or good will.
But which acts are morally good ones?
The categorical imperative would only apply universally -- so to test for it, we can ask if the action under question could apply universally..
"Act only on that maxim whereby you can at the same time will that it should become a universal law."
For example, is lying morally acceptible? No, because if everyone felt free to lie, no one could have faith in promises, therefore promises would no longer exist, thus lies no longer exist.
Is suicide morally acceptible? No, because allowing self-love to lead to self-descruction is contradictory.
Is withholding kindness and charity morally acceptible? No, because you would find yourself in need of it, so in attempting to improve your life you would harm your life, which is a contradiction.
"Treat humanity, whether in your own person or in that of another, in every case as an end. . ., never as means only. . .."