The present invention discloses a method for diagnosing and detecting cancer by bioimaging using methylene blue nanoparticle as a contrasting agent. The methylene blue nanoparticle of the present invention for use as a topical cancer targeting phototherapeutic agent is composed of only a material of which the composition is clinically used or derived from human bodies, and thus a nanopreparation in which a barrier to clinical entry is low and the possibility of commercialization is very high, exhibits near-infrared fluorescence along with cancer targeting property, a capacity of generating a singlet oxygen and the like. Therefore, the methylene blue nanoparticle in the present invention is able to detect cancerous cells by emitting visible light in irradiation conditions.