The cooking time for spaghetti can vary depending on the brand and thickness of the pasta, as well as personal preference for the desired level of doneness. In general, most dried spaghetti will take about 8 to 12 minutes to cook until it is al dente, which means it is still firm to the bite but cooked through. It's essential to follow the cooking instructions on the pasta package for the most accurate cooking time. Additionally, fresh spaghetti or homemade pasta may have a shorter cooking time, typically around 1 to 3 minutes.