Dividing by 1023 or 1024? The final verdict on analogRead

This just shows how incompetent you are for this discussion. Using such precise reference for Arduino's poor ADC (typical error is 2 LSB!) is wasteful. You could get better resolution by using worse reference and better ADC for the same money. Or you can get the same resolution much cheaper when you use worse reference.

Robin2:
It clearly explains how it converts voltages to ADC values. It does NOT explain how to convert ADC values to voltages.

It does not say that because the whole idea of converting ADC result to voltage is silly. It gives hints how the ADC value is obtained. It is trivial to reverse the process. I don't understand why there is so much emotions about it.

adwsystems:
No matter whether you use 1023 or 1024 the bucket size is the same for each step. 5/1023 or 5/1024.

The bucket size is always Vref/1024.

adwsystems:
If you use 1023, then voltage value returned has a progressive shift from returning the minimum value to returning the maximum value. Count = 0 returns 0V for voltages from 0 V to just short of 4.887586mV (5/1023), but count = 1023 returns a value of 5V, and is returned for any voltage from 4.995112 through 5V.

Using 1023 divider you read 0V from 0V to 5/1024V. You read 5/1023V for input from 5/1024V to 10/1024V etc. But you are right the returned value is "drifting" in the correct range.

adwsystems:
If you follow the datasheet, then each bucket is 5/1024 volts and count = 0 returns 0 V for input voltage up to 4.8828124mV and count = 1023 returns 4.995117mV for all input voltages from there to 5V. Using 1024, 5V is never returned; that is what the datasheet is saying.

The datasheet does not say you should use 1024 and so you cannot get 5V! It just says 1023 represents voltage higher than Vref-1LSB. It is up to you what value you assign to this range.