Commutative monoids are characterized to satisfy the condition that all ideals are principal. Monoids which are principal ideal monoids (PIM) were characterized and special attention was paid to finitely generated monoids. This characterization was used to construct an algorithm for deciding whether a finitely generated commutative monoid satisfied the condition.