The diagnosis of cystic fibrosis is usually confirmed in infancy or early childhood, but cystic fibrosis goes undetected until adolescence or early adulthood in about 10% of people with the disease.

The diagnosis is suggested by one or more of the typical symptoms and is confirmed by a sweat test. This test measures the amount of salt in sweat. The drug pilocarpine
is placed on the skin to stimulate sweating, and filter paper or thin tubing is placed against the skin to collect the sweat. The concentration of salt in the sweat is then measured. A salt concentration higher than normal confirms the diagnosis in people who have symptoms of cystic fibrosis or who have a sibling with cystic fibrosis. Although the results of this test are valid any time after a newborn is 48 hours old, collecting a large enough sweat sample from a newborn younger than 3 or 4 weeks old may be difficult. The sweat test, which can be performed on an outpatient basis, can also confirm the diagnosis in older children and young adults.

In newborns with cystic fibrosis, the level of the digestive enzyme, trypsin, in the blood is high. This enzyme level can be measured in a small drop of blood collected on a piece of filter paper. Measurement of this enzyme in addition to sweat testing and genetic testing is the basis of cystic fibrosis newborn screening programs performed in many parts of the world. However, this test is not yet routinely performed in the United States.

The diagnosis of cystic fibrosis can also be confirmed by genetic testing in a person who exhibits one or more typical symptoms or has a history of cystic fibrosis in a sibling. Finding two abnormal cystic fibrosis genes (mutations) confirms the diagnosis. However, because genetic testing can confirm only a small percentage of the more than 1000 different kinds of cystic fibrosis mutations, failure to detect two mutations does not exclude a diagnosis of cystic fibrosis. The disease can be diagnosed prenatally by performing genetic testing on the fetus using chorionic villus sampling or amniocentesis.

Because cystic fibrosis can affect several organs, other tests may be helpful. If pancreatic enzyme levels are reduced, an analysis of the person's stool may reveal low or undetectable levels of the digestive enzymes trypsin and chymotrypsin (both secreted by the pancreas) or high levels of fat. If insulin secretion is reduced, blood sugar levels are high. Pulmonary function tests may show that breathing is compromised and are good indicators of how well the lungs are functioning. Also, chest x-rays and computed tomography may be helpful to document lung infection and the extent of lung damage.

Carrier testing can be performed for prospective parents. In particular, relatives of a child with cystic fibrosis may want to know if they are likely to have children with the disease, and they should be offered genetic testing and counseling. A small blood sample is taken to help determine if a person has a defective cystic fibrosis gene. Unless both prospective parents have at least one such gene, their children will not have cystic fibrosis. If both parents carry a defective cystic fibrosis gene, each pregnancy has a 25% chance of producing a child with cystic fibrosis.