We should act only according those maxims that could be universally accepted and acted on.
Kant believed that truth telling could, but lying could not, be made a universal law.
If everyone lied whatever it suited them, rational communication would be impossible. Thus lying is unethical