Using scanning tunnelling microscopy (STM) and x-ray diffraction (XRD), the assembling behaviour of substituted phthalocyanine and porphyrin on both hydrophobic and hydrophilic surfaces was investigated. Copper (II) 2,3,9,10,16,17,23,24-octakis(octyloxy)-29H,31H-phthalocyanine (denoted as CuPcOC8) and 21,23-dihydro-5,10,15,20-tetrakis[4-(tetradecyloxy)phenyl]porphyrin (TTPP) molecules adsorb stably on a highly oriented pyrolytic graphite (HOPG) surface, yielding high-resolution STM images. The results illustrate that alkyl molecular anchors can be used as a generalized approach for immobilization of organic molecules on hydrophobic surfaces. The XRD results show that on a hydrophilic substrate CuPcOC8 and TTPP form completely different assembled structures from those on a HOPG surface, which indicates that the polarity of the substrate has substantial effects on the assembling behaviour of organic molecules.