Giardia duodenalis is a common intestinal parasite in humans and other mammals, and it causes major public and veterinary health problems worldwide. China is a major pig-raising country, and studies on Giardia in pigs have important public health significance. The present study was conducted to investigate the prevalence of Giardia and assess its genetic characterization. A total of 93 samples were collected from two farms in Shanghai. The presence of Giardia was determined using PCR and sequence analysis of glutamate dehydrogenase, beta-giardin and triose phosphate isomerase genes. The average prevalence of G. duodenalis infection was 26.88% (25/93) in the pigs, with 28.13% (18/64) in farm 1 vs 24.14% (7/29) in farm 2. All the PCR-positive products were successfully sequenced, and assemblage E was more prevalent. Zoonotic assemblages A and B and canine-specific assemblage C were identified in farm 1, whereas, only assemblage E was detected in farm 2. Interestingly, two pig isolates showed 100% homology with human-derived isolates from Australia and China at the bg and tpi loci respectively. Pigs infected with Giardia infect humans by polluting the environment; whether pigs are a potential environmental source of the human pathogen in China requires more epidemiological data.