In general, the idea is a jail is where people who are accused of a crime stay while they are awaiting trial if the nature of their potential crime warrants it, a prison is where people who have been convicted of their crime serve their sentences after the trial. But it is confusing because jails are often used for short sentences (on the order of a few days or months).