Letterbox Calculator
Type the size of your picture or video and the size of the frame it has to fit, for example a 1920 x 1080 clip in a vertical 1080 x 1920 frame. In fit mode the calculator shows the scaled size, whether you get a letterbox (bars above and below) or a pillarbox (bars at the sides), and the size of each bar. In fill mode it shows how much is cropped instead. A small drawing shows the result, and a ready ffmpeg filter does the job. An option keeps the sizes even for video encoders. Everything runs in your browser.
To fit a picture inside a frame, scale it by the smaller of frame width divided by picture width and frame height divided by picture height, so that one side touches the frame and the other falls short. The gap is split in two to center the picture: bars above and below are a letterbox, bars at the sides are a pillarbox. To fill the frame instead, scale by the larger of the two numbers and cut off the overflow. With even sizes on, the scaled size is rounded down to an even number when fitting, so a bar can differ by a pixel. Everything runs in your browser.
Related Tools
[5 suggestions]Crop to Aspect Ratio Calculator: Size and Position of the Crop
Find the largest crop of any aspect ratio inside an image, with its size, where it starts, what is cut away, and ready-made ffmpeg, ImageMagick and CSS settings.
Developer & WebVideo Resolution Calculator: Sizes for Any Aspect Ratio
List the video resolutions from 144p to 8K for any aspect ratio, with sides rounded to a multiple of 2, 4, 8 or 16, plus every whole-pixel size with the exact ratio.
Developer & WebAspect Ratio Calculator
Find the aspect ratio of any width and height, resize while keeping it, and get the CSS aspect-ratio rule.
Developer & WebImage Resizer
Resize an image by width, height or percent, crop it to an exact size, and save it as PNG, JPEG or WebP, all in your browser.
Format ConversionRatio Calculator
Simplify a ratio, list equivalent ratios, solve A : B = C : D for the missing term, and scale or split a total in a ratio.
Math & MoneyAbout the Letterbox Calculator
To fit a picture inside a frame, scale it by the smaller of frame width divided by picture width and frame height divided by picture height, so that one side touches the frame and the other falls short. The gap is split in two to center the picture. A 1920 x 1080 video in a 1080 x 1920 frame scales to 1080 x 608 (56.25%), leaving bars of 656 pixels above and below, and the picture covers only 31.67% of the frame. A 2.39:1 film frame of 1920 x 804 in a 1920 x 1080 frame gets bars of 138 pixels above and below. A 4:3 picture of 1440 x 1080 in the same frame gets pillarbox bars of 240 pixels on each side and covers 75%. To fill the frame instead, scale by the larger of the two ratios and cut off the overflow: the same 16:9 video in a square 1080 x 1080 frame keeps the middle 1080 pixels of the 1920, cutting 420 from each side, so 56.25% of the picture stays. If the leftover gap is odd, one bar is a pixel larger. With even sizes on, the scaled size is rounded down to an even number so the video encoders that need even sides accept it.
What is the difference between letterbox and pillarbox?▾
A letterbox has bars above and below the picture, which happens when the picture is wider than the frame. A pillarbox has bars at the left and right, which happens when the picture is taller or narrower than the frame.
Should I add bars or crop?▾
Bars keep the whole picture but waste screen space. Cropping fills the frame but cuts off the edges. The tool shows both so you can see what is lost: the covered share for bars, or the kept share for a crop.
How do I add the bars with ffmpeg?▾
Scale the video to fit with force_original_aspect_ratio=decrease and then use the pad filter with (ow-iw)/2 and (oh-ih)/2 to center it. The tool writes the full filter for your sizes. The bars are black unless you set a pad color.
Why must video sizes be even?▾
Many encoders, such as H.264 with the usual 4:2:0 color format, need an even width and height. The even option rounds the scaled size down to an even number.
Is my video uploaded?▾
No. You only type sizes, and the calculation runs in your browser.