Frequent offshore oil spill accidents, industrial oily sewage, and the indiscriminate disposal of urban oily sewage have caused seri-ous impacts on the human living environment and health. The traditional oil–water separation methods not only cause easily environmental secondary pollution but also a waste of limited resources. Therefore, in this work, three-dimensional (3D) graphitic carbon sphere (GCS) foams (collectively referred hereafter as 3D foams) with a 3D porous structure, pore size distribution of 25–200 μm, and high porosity of 62vol%were prepared for oil adsorption via gel casting using GCS as the starting materials. The results indicate that the water contact angle (WCA) of the as-prepared 3D foams is 130°. The contents of GCS greatly influenced the hydrophobicity, WCA, and microstructure of the as-prepared samples. The adsorption capacities of the as-prepared 3D foams for paraffin oil, vegetable oil, and vacuum pump oil were approximately 12–15 g/g, which were 10 times that of GCS powder. The as-prepared foams are desirable characteristics of a good sorbent and could be widely used in oil spill accidents.