You can actually pass on a cold from shortly before symptoms start and are typically most infectious in the first few days when sneezing and a runny nose are at their peak. Contagiousness generally fades as symptoms improve, but you may spread the virus for up to about a week, and sometimes a little longer if symptoms persist.
To reduce spread, wash your hands often, cover coughs and sneezes with a tissue or your elbow, dispose of tissues promptly, and avoid close contact with vulnerable people while you are unwell.
Flu tends to be contagious from about a day before symptoms until roughly five to seven days after they begin, and longer in children and people with weakened immune systems. Staying home while feverish helps protect others.