Focal Length Compare
Slide the focal length from 14mm to 200mm and see field of view, compression and blur change.
AI prompt
Portrait of [subject] standing in front of a busy city street, shot on an [85mm] lens at f/1.8, strong background compression, creamy out-of-focus bokeh, flattering facial proportions, subject sharp from eyes to shoulders, natural window-like daylight. Lens guide: 14mm ultra wide, stretched perspective and large depth, background tiny and sharp; 35mm natural storytelling view; 85mm portrait compression, background looks closer and softer; 200mm telephoto, flat stacked layers, heavy blur. Keep subject size the same when changing the lens. Negative: wide-angle distortion, stretched face, deep focus, sharp background. Use "macro lens, 100mm, extreme shallow depth of field" for tiny objects and "fisheye lens, 8mm" for a circular distorted look.About this pattern
Definition
Focal length sets how much of the scene a lens sees (field of view) and how close background and foreground appear to each other. Short lenses see wide and stretch space; long lenses see narrow and compress it.
When to use it
- 14 to 24mm: landscapes, interiors, dramatic close shots with exaggerated depth.
- 35 to 50mm: natural, documentary look close to human vision.
- 85 to 135mm: portraits with flattering compression and soft backgrounds.
- 200mm and beyond: sports, wildlife, strongly compressed layered scenes.
What the controls do
- Slider range 14 to 200mm with live readouts of field of view (full-frame, horizontal) and a plain-language label.
Motion & timing
- Updates instantly while dragging; background blur grows from 35mm upward to mimic shallow depth of field.
- Reduced motion: nothing animates, since the effect follows the slider directly.
Tips & variations
- The demo keeps the subject at the same size, the way a photographer would step back or forward, so only the background changes.
- In prompts, name the focal length in millimetres; models respond to it consistently.
Code of this live preview
<div class="fr"><div class="bg" id="bg"></div><div class="sub"></div><span class="rd" id="rd"></span></div>
<label class="ctl">Focal length <b id="mm">50mm</b><input id="f" type="range" min="14" max="200" value="50" aria-valuetext="50 millimetres"></label>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.fr{position:relative;width:min(300px,100%);height:170px;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:#eceeef}
.bg{position:absolute;left:50%;bottom:40px;display:flex;gap:calc(14px * var(--s,1));transform:translateX(-50%) scale(var(--s,1));transform-origin:50% 100%;filter:blur(var(--bl,0px))}
.bg i{flex:none;width:26px;background:#9a9a94;border-radius:2px 2px 0 0}
.bg i:nth-child(1){height:60px}.bg i:nth-child(2){height:90px}.bg i:nth-child(3){height:48px}.bg i:nth-child(4){height:110px}.bg i:nth-child(5){height:70px}.bg i:nth-child(6){height:96px}.bg i:nth-child(7){height:54px}.bg i:nth-child(8){height:84px}.bg i:nth-child(9){height:64px}
.sub{position:absolute;left:50%;bottom:20px;width:34px;height:96px;margin-left:-17px;border-radius:17px 17px 4px 4px;background:#171717}
.sub::before{content:"";position:absolute;left:5px;top:-14px;width:24px;height:24px;border-radius:50%;background:#171717}
.rd{position:absolute;left:8px;top:6px;font-size:11px;background:rgba(255,255,255,.85);padding:1px 8px;border-radius:99px}
.ctl{width:min(300px,100%);margin-top:10px;display:grid;font-size:12px;color:var(--muted);gap:4px}
.ctl b{color:var(--text);font-size:13px}
input[type=range]{width:100%;accent-color:#171717}
input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.bg{transition:none}}const f=document.getElementById('f'),bg=document.getElementById('bg'),mm=document.getElementById('mm'),rd=document.getElementById('rd');
for(let i=0;i<9;i++){bg.append(document.createElement('i'));}
function apply(){const v=+f.value,s=Math.pow(v/35,.85),bl=Math.max(0,Math.min(5,(v-40)/34)),fov=2*Math.atan(18/v)*180/Math.PI;
bg.style.setProperty('--s',s.toFixed(3));bg.style.setProperty('--bl',bl.toFixed(1)+'px');mm.textContent=v+'mm';f.setAttribute('aria-valuetext',v+' millimetres');
const lbl=v<=24?'Ultra wide: stretched depth':v<=40?'Wide: natural storytelling':v<=70?'Standard: close to the eye':v<=135?'Portrait: compressed, soft':'Telephoto: flat, stacked layers';
rd.textContent=Math.round(fov)+'° view · '+lbl;}
f.addEventListener('input',apply);apply();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Focal Length Compare — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.fr{position:relative;width:min(300px,100%);height:170px;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:#eceeef}
.bg{position:absolute;left:50%;bottom:40px;display:flex;gap:calc(14px * var(--s,1));transform:translateX(-50%) scale(var(--s,1));transform-origin:50% 100%;filter:blur(var(--bl,0px))}
.bg i{flex:none;width:26px;background:#9a9a94;border-radius:2px 2px 0 0}
.bg i:nth-child(1){height:60px}.bg i:nth-child(2){height:90px}.bg i:nth-child(3){height:48px}.bg i:nth-child(4){height:110px}.bg i:nth-child(5){height:70px}.bg i:nth-child(6){height:96px}.bg i:nth-child(7){height:54px}.bg i:nth-child(8){height:84px}.bg i:nth-child(9){height:64px}
.sub{position:absolute;left:50%;bottom:20px;width:34px;height:96px;margin-left:-17px;border-radius:17px 17px 4px 4px;background:#171717}
.sub::before{content:"";position:absolute;left:5px;top:-14px;width:24px;height:24px;border-radius:50%;background:#171717}
.rd{position:absolute;left:8px;top:6px;font-size:11px;background:rgba(255,255,255,.85);padding:1px 8px;border-radius:99px}
.ctl{width:min(300px,100%);margin-top:10px;display:grid;font-size:12px;color:var(--muted);gap:4px}
.ctl b{color:var(--text);font-size:13px}
input[type=range]{width:100%;accent-color:#171717}
input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.bg{transition:none}}
</style></head>
<body><div class="stage">
<div class="fr"><div class="bg" id="bg"></div><div class="sub"></div><span class="rd" id="rd"></span></div>
<label class="ctl">Focal length <b id="mm">50mm</b><input id="f" type="range" min="14" max="200" value="50" aria-valuetext="50 millimetres"></label>
</div>
<script>
const f=document.getElementById('f'),bg=document.getElementById('bg'),mm=document.getElementById('mm'),rd=document.getElementById('rd');
for(let i=0;i<9;i++){bg.append(document.createElement('i'));}
function apply(){const v=+f.value,s=Math.pow(v/35,.85),bl=Math.max(0,Math.min(5,(v-40)/34)),fov=2*Math.atan(18/v)*180/Math.PI;
bg.style.setProperty('--s',s.toFixed(3));bg.style.setProperty('--bl',bl.toFixed(1)+'px');mm.textContent=v+'mm';f.setAttribute('aria-valuetext',v+' millimetres');
const lbl=v<=24?'Ultra wide: stretched depth':v<=40?'Wide: natural storytelling':v<=70?'Standard: close to the eye':v<=135?'Portrait: compressed, soft':'Telephoto: flat, stacked layers';
rd.textContent=Math.round(fov)+'° view · '+lbl;}
f.addEventListener('input',apply);apply();
</script>
</body></html>