Laxatives are medicines that are used to treat constipation. They can be taken by mouth as liquids, tablets, or capsules, or they can be given via the back passage (rectum). Laxatives are generally divided into four groups - depending on the way they work.