The optimal size of a pinhole for a pinhole camera depends on the pinhole-to-film distance and the wavelength of light. The formula proposed by Lord Rayleigh, revised so that the result gives the diameter, not the radius, can be written as follows: d – pinhole diameter, f – focal length, l – wavelength (usually the wavelength for yellow/green light 0.00055 mm is used). Different sources provide different values for the constant c in the formula, which can result in a difference of 34% between the smallest and largest suggested value. However, most sources agree that the optimal diameter for a pinhole camera is between 0.185 mm and 0.3 mm.
Some methods to measure the pinhole diameter include using a digital camera with a macro lens, a phone camera, or scanning the pinhole at the highest possible resolution and opening it in Photoshop. Another method involves using a needle to drill the pinhole and then measuring it with a ruler or a scanner.
It is important to note that deviations from the "perfect" setup can produce interesting effects in pinhole photography.