HS codes are assigned based on a product's description, composition, and intended use. The code is made up of six digits that represent the product category, followed by four additional digits that identify the specific product in more detail. Each country may also have their own additional tariffs and regulations associated with specific HS codes.