Use a hyphen between the words for 21 to 99. For example, write 346 as "three hundred forty-six."
Omit the hyphen between a number and a unit of measurement when counting the units. For example, "He jogged 10 miles every morning."
Add a hyphen between a unit of measurement and a number when they act together to describe something else. For instance, "Cut the board into 3-foot segments," or "The 30-year mortgage was finally paid off."