Drug checking or pill testing is a way to reduce the harm from drug consumption by allowing users to find out the content and purity of substances that they intend to consume. This enables users to make safer choices: to avoid more dangerous substances, to use smaller quantities, and to avoid dangerous combinations. 
Drug checking services have developed over the last twenty-five years in twenty countries and are being considered in more countries, although attempts to implement them in some countries have been hindered by local laws. Drug checking initially focused on MDMA users in electronic dance music events but the services have broadened as drug use has become more complex. These developments have been strongly affected by local laws and culture, resulting in a diverse range of services, both for mobile services that attend events and festivals and fixed sites in town centres and entertainment districts. For instance, staff may or may not be able to handle illegal substances, which limits the use of testing techniques to those where the staff are not legally in possession of those substances.
People intending to take drugs provide a small sample to the testing service (often less than a single dose). Test results may be provided immediately, after a short waiting period, or later. Drug checking services use this time to discuss health risks and safe behaviour with the service users. The services also provide public health information about drug use, new psychoactive substances and trends at a national level.