A browser-based tool that tells you at which f-number your camera sensor becomes diffraction-limited.
🔗 Live demo: https://lbarjak.github.io/diffraction-limit-calculator/
When you stop down a lens (increase the f-number), diffraction causes light to spread into an Airy disk pattern. If the Airy disk becomes larger than a single pixel, the lens can no longer resolve detail at the pixel level — this is called diffraction limiting.
The critical f-number N_critical is the point where the Airy disk diameter equals the pixel pitch. Shooting at f-numbers higher than N_critical will degrade sharpness regardless of how sharp the lens is.
horizontal_pixels = sqrt(megapixels × 1,000,000 × (sensor_width / sensor_height))
pixel_pitch (mm) = sensor_width / horizontal_pixels
N_critical = pixel_pitch / (1.22 × λ) where λ = 0.00055 mm (550 nm green light)
Airy_disk_diameter = 2.44 × λ × N
- Open the app in a browser.
- Select a preset camera from the list, or choose Custom… to enter your own sensor parameters.
- If custom: enter sensor width (mm), sensor height (mm), and megapixels.
- The results page shows:
- Calculated pixel pitch (µm)
- N_critical — the diffraction-limiting f-number
- A visual f-stop scale bar with a green (sharp) zone and a red (diffraction-limited) zone
index.html — Main HTML, inline CSS, <script type="module"> entry point
src/
app.js — App class: orchestration
sensordata.js — SensorData class: preset camera data
calculator.js — Calculator class: diffraction calculations
menu.js — Menu class: preset selection and custom input form
display.js — Display class: results and visual f-stop scale bar
No build step required. Serve the project root with any static file server:
npx serve .
# or
python3 -m http.server 8080Then open http://localhost:8080 in your browser.
Note: You must use a server (not
file://) because ES6 modules require HTTP(S).