Image from NOAA, in the public domain.
I just finished a large project trying to estimate that. I’ve posted it on its own page here. Here’s the abstract:
We estimate that there are between about 10^24 neurons on earth, with about an order of magnitude uncertainty. Most of these are from insects, with significant contributions from nematodes and fish. For insects, we multiplied the apparent number of insects on earth by the number of neurons in a small insect, the fruit fly. Most other classes of animal contribute 10^22 neurons at most, and so are unlikely to change the final analysis. For nematodes, we looked at studies that provide an average number of nematodes per square meter of soil or the ocean floor, and multiplied them by the number of neurons in Caenorhabditis elegans, an average-sized nematode. Fish may also play a significant role. We neglected a few categories that probably aren’t significant, but could conceivably push the estimate up.
Using a similar but less precise process based on evolutionary history and biomass over time, we also estimate that there have been 10^33 neuron-years of work over the history of life, again with around an order of magnitude of uncertainty.