Card counting is not illegal, but it is frowned upon by casinos. It involves keeping track of the cards that have been dealt to gain an advantage in blackjack. While not against the law, casinos have the right to refuse service to card counters. It requires skill and practice to be successful at card counting. Some casinos use countermeasures to prevent card counting, such as shuffling the deck more frequently. Overall, the legality of card counting varies by jurisdiction.