How to cut molding?

I took the carpet off the stairs and painted them. But there is a gap on each side of the stair treads. How can I fix this or is there a way to cut molding to fit.

  3 answers