In this study, polyurethane (PU) alone or in blend with 10% polystyrene (PS) or poly(vinylidene fluoride‐co‐hexafluoropropylene) (PVDF‐HFP) was used for electrospinning (ES) of nanofibers. The optimum conditions for obtaining the minimum fiber diameter were found to be [polymer] = 10 wt %, polymer feed rate = 2 mL h−1, voltage = 21 kV, tip to collector distance = 21 cm, and the drum speed = 600 rpm. The time of ES was used as a parameter for controlling the thickness and the average pore size diameter of the membranes. The average pore size diameter decreased almost linearly by increasing the thickness. The resulting electrospun membranes were hydrophobic and oleophilic in nature with the water contact angle above 130°. The hydrostatic pressure head of the membranes increased by decreasing the average pore size diameter. The maximum initial oil separation flux was achieved for the membranes with larger average pore size diameters in the order of: PU9:1PS > PU > PU9:1PVDF‐HFP. The membranes were used for four consecutive cycles without any noticeable loss of separation performance. The diesel oil recovery percentage after 1 h was found to be above 85% for the PU9:1PS and PU membranes. A commercially available polytetrafluoroethylene membrane, with a thickness of 94 μm and the average pore size diameter of 0.45 μm, was used for benchmarking. © 2018 Wiley Periodicals, Inc. J. Appl. Polym. Sci. 2018, 135, 46890.