Two-dimensional materials, e.g. graphene and molybdenum disulfide (MoS(2)), have attracted great interest in recent years. Identification of the thickness of two-dimensional materials will improve our understanding of their thickness-dependent properties, and also help with scientific research and applications. In this paper, we propose to use optical imaging as a simple, quantitative and universal way to identify the thickness of two-dimensional materials, i.e. mechanically exfoliated graphene, nitrogen-doped chemical vapor deposition grown graphene, graphene oxide and mechanically exfoliated MoS(2). The contrast value can easily be obtained by reading the red (R), green (G) and blue (B) values at each pixel of the optical images of the sample and substrate, and this value increases linearly with sample thickness, in agreement with our calculation based on the Fresnel equation. This method is fast, easily performed and no expensive equipment is needed, which will be an important factor for large-scale sample production. The identification of the thickness of two-dimensional materials will greatly help in fundamental research and future applications.