How do online services (Netflix and other online services that have a subscription) know what card company you have just by 1 or 2 numbers?

I've always wondered this when I put in my card info

How do online services (Netflix and other online services that have a subscription) know what card company you have just by 1 or 2 numbers?
Post Opinion