How long can cooked pasta stay fresh at room temperature?

Cooked pasta should not be left at room temperature for more than 2 hours, as it is a perishable food that can quickly become contaminated with bacteria and cause foodborne illness. After cooking, pasta should be either consumed immediately or refrigerated promptly to prevent spoilage and maintain its quality and safety. Storing cooked pasta in an airtight container in the refrigerator can help extend its shelf life for several days.