This is a question that cannot be answered with any accuracy. However, it is interesting to consider how we can get as close as possible to a satisfactory answer. We would need first to find the volume of sand in the world (by far the biggest stretches of sand being the Sahara and Gobi Deserts), then plot the particle-size distribution at each place, and finally work out the average particle size of the sand.
If the question is taken literally – namely, how many grains of sand there are in the world – we are interested specifically in rock detritus with a particle diameter of 0.06-2 mm. According to standard sedimentological classification, detrital material is called clay if the diameter of the particles, d, is less than 0.002 mm, silt if d is 0.002-0.06 mm, sand if 0.06-2 mm, gravel if 2-64 mm, cobble if 64-256 mm, and boulder if greater than this.
The Sahara Desert.
Let’s assume that all the grains of sand are spherical and of equal size. If so, they will ‘pack together’ with maximal compaction, such that the spheres themselves fill 68% of the total volume. If the diameter of the grains is on average 1 mm, this would give 1.30 × 109 (1,300 million) grains in one cubic metre of sand.
For the sake of argument, say that all the sand in the world forms an even layer, 10 cm thick, over the entire surface of the earth, which covers 510 million km2 (200 million square miles). Then the volume of the sand will be 5.10 × 1013 cubic metres and the number of grains thus
5.10 × 1013 × 1.30 × 109 = 6.63 × 1022
If the layer of sand was only half as thick, the number of grains would be halved, and if the layer was a metre thick there would be ten times as many. As it is, we simply do not know how thick the layer is in reality, nor what the average particle size is. It is perhaps fun to compare our result with Avogadro’s number, which is about 10 times greater.
By way of comparison, consider the famous Indian legend about the invention of chess and the grains of rice. The inventor presents the game to the king and asks for payment in grains of rice – one for the first square, two for the second, four for the third, eight for the fourth, and so on. There are 64 squares. The result comes out at 1.84 × 1019 grains of rice, which is about 4,000 times less than the number of grains of sand in the world on the basis of our calculations above. To bring the number of grains of rice up to our number for the grains of sand, you would need a chessboard with 76 squares instead of 64.