This study was conducted to develop a novel algorithm for determining the origin of tumors by combining analysis of cluster patterns with immunocytochemistry (ICC) for markers in cells from fine-needle aspirates of ascites. We used LBC, based on SurePathTM (BD Diagnostics) technology, to screen 96 peritoneal fluid samples from patients with known malignancies and from 10 control patients with cirrhosis. Following dual ICC staining for cytokeratin 7 (CK7) and paired box gene 8 (PAX8), we developed an algorithm using immunoreactivity and three-dimensional (3D) cluster patterns to correlate staining and 3D cluster patterns with common primary origins that included stomach, ovarian, pancreatobiliary tract, colon, lung, and breast cancers. With the application of an automatic digitalized image analyzer, competence performance was analyzed using receiver operating characteristics (ROC) curve analysis. CK7 and PAX8 staining and 3D cluster patterns were used to differentiate primary origins. Samples from patients with stomach cancer were no 3D cluster /CK7+/PAX8- with area under the curve (AUC) of 0.8699 in ROC curve analysis. Samples from ovarian cancer patients were large 3D cluster/CK7+/PAX8+ with AUC of 0.9812. Samples from pancreatobiliary tract cancer patients were small 3D cluster/CK7+/PAX8- with AUC of 0.8772. The remaining cancer samples, including breast, lung and colon cancer samples, had similar patterns of large 3D clusters/CK7+/PAX8- with AUC of 0.882, especially for lung cancer. SurePathTM technology, using 3D cluster patterns and dual ICC for CK7 and PAX8 in peritoneal fluid samples, can provide important information for determining specific primary origins in cases of unknown primary carcinoma.