Magistrates have limited sentencing powers but they can impose custodial sentences of up to 6 months imprisonment for a single offence or of up to 12 months for multiple offences.
Some cases which start before magistrates (such as murder) MUST be passed to the Crown Court, as they're 'indictment only' cases. Some cases (such as minor motoring matters) may ONLY be heard before magistrates, as they're 'summary only' cases.
Many cases though are 'either way'. Magistrates can hear them as long as they're satisfied that, if the defendant is convicted, their sentencing powers will be sufficient (and also that there aren't any complex legal issues that need to be dealt with by a Crown Court); otherwise they'll refer the case to the Crown Court.
This might be of interest to you, Tilly:
http://www.judiciary.gov.uk/you-and-the-judiciary/going-to-court/magistrates-court