Beam Deflection Calculator: Formulas, Worked Examples, Python and Excel

·

3D illustration of a simply supported beam bending under point loads for a beam deflection calculator

A beam can be strong enough and still be too flexible to use. A floor that bounces, a shaft that lets gears drift out of mesh, or a bracket that sags under a motor are all deflection problems, not strength problems. This guide gives you the four most common deflection formulas, shows how to use them step by step with two worked examples, and ends with a free Python script you can copy and a matching Excel calculator.

Who this is for: mechanical and civil engineering students, and early-career engineers who need a quick, checkable estimate. Limits: it covers straight, uniform beams in the elastic range with small deflections. It is a learning aid, not a replacement for a design check by a qualified engineer.

The four standard cases

Here L is the span, E is Young’s modulus, I is the second moment of area of the cross-section, P is a point load and w is a load per unit length. The product EI is the beam’s bending stiffness.

CaseMaximum deflectionMaximum bending moment
1. Simply supported, point load at mid-spanPL³ / 48EIPL / 4
2. Simply supported, uniform load5wL⁴ / 384EIwL² / 8
3. Cantilever, point load at free endPL³ / 3EIPL
4. Cantilever, uniform loadwL⁴ / 8EIwL² / 2

Notice that deflection grows with the cube or the fourth power of the span. Doubling the span of a loaded beam makes it roughly eight to sixteen times more flexible, while doubling the depth of a rectangular section makes it eight times stiffer.

Step-by-step method

  1. Find I. Rectangle: bh³/12. Solid circle: πd⁴/64. Hollow tube: π(D⁴ − d⁴)/64. Use millimetres, so I is in mm⁴.
  2. Choose E. About 200 GPa for steel and 69 GPa for aluminium. Convert to N/mm² (200 GPa = 200,000 N/mm²).
  3. Calculate the maximum deflection with the right case formula. Keep loads in newtons and lengths in millimetres. A load of 1 kN/m equals 1 N/mm, which saves a conversion.
  4. Find the maximum bending moment M from the table.
  5. Find the maximum bending stress: σ = M·c / I, where c is the distance from the neutral axis to the outermost fibre (half the depth for a symmetric section).
  6. Check both limits: stress against yield strength (factor of safety), and deflection against the allowed value for your application.

Worked example 1: steel beam, point load at mid-span

A simply supported structural steel bar (S275, E = 200 GPa, yield strength 275 MPa) has a rectangular section 50 mm wide and 100 mm deep. The span is 2 m and it carries 5 kN at mid-span. Self-weight is ignored.

  • I = 50 × 100³ / 12 = 4.167 × 10⁶ mm⁴
  • Deflection = PL³ / 48EI = 5000 × 2000³ / (48 × 200,000 × 4.167 × 10⁶) = 1.00 mm, which is L/2000.
  • M = PL/4 = 5000 × 2000 / 4 = 2.5 × 10⁶ N·mm = 2.5 kN·m
  • σ = M·c / I = 2.5 × 10⁶ × 50 / 4.167 × 10⁶ = 30 MPa
  • Factor of safety against yield = 275 / 30 = 9.2

A common floor-beam guideline is to keep deflection under span/360, which is 5.6 mm here, so this beam passes comfortably. Allowed deflection depends on the application and on the code or standard you work to, so treat L/360 as a typical starting point, not a rule.

Worked example 2: aluminium tube cantilever (strong but too flexible)

An aluminium 6061-T6 tube (E = 69 GPa, yield strength 240 MPa) with a 60 mm outside diameter and 4 mm wall is fixed at one end and projects 1.2 m. It carries a uniform load of 0.5 kN/m (0.5 N/mm).

  • Inner diameter = 60 − 2 × 4 = 52 mm, so I = π(60⁴ − 52⁴) / 64 = 2.773 × 10⁵ mm⁴
  • Deflection = wL⁴ / 8EI = 0.5 × 1200⁴ / (8 × 69,000 × 2.773 × 10⁵) = 6.77 mm
  • M = wL²/2 = 0.5 × 1200² / 2 = 360,000 N·mm = 0.36 kN·m
  • σ = 360,000 × 30 / 2.773 × 10⁵ = 39 MPa, a factor of safety of 6.2

The tube is safe against yielding, but the free end drops 6.8 mm. If your limit is span/360 (3.3 mm), it fails. The lesson: stiffness often governs before strength does, especially for aluminium, which is about one third as stiff as steel. A larger diameter is the cheapest fix because I grows with the fourth power of diameter. Keeping a 4 mm wall, a 70 mm tube gives 4.1 mm (still too much), and an 80 mm tube gives 2.7 mm (passes).

The Python script

This compact version handles all four cases and returns deflection, moment, stress and factor of safety. Copy it into a file or paste it into Google Colab and run it.

import math
def section_properties(kind, d1, d2=None):
"""Return (I in mm^4, c in mm).
rect: d1=width b, d2=height h | circle: d1=diameter | tube: d1=outer D, d2=inner d"""
if kind == "rect":
return d1 * d2**3 / 12, d2 / 2
if kind == "circle":
return math.pi * d1**4 / 64, d1 / 2
if kind == "tube":
return math.pi * (d1**4 - d2**4) / 64, d1 / 2
raise ValueError("kind must be rect, circle or tube")
def beam(case, L_m, load, E_GPa, I, c, yield_MPa, limit_ratio=360):
"""case 1: SS point load | 2: SS uniform | 3: cantilever point | 4: cantilever uniform
load is kN for cases 1 and 3, kN/m for cases 2 and 4"""
L, E = L_m * 1000, E_GPa * 1000 # mm, N/mm^2
P, w = load * 1000, load # N, N/mm (1 kN/m = 1 N/mm)
if case == 1: delta, M = P*L**3/(48*E*I), P*L/4
elif case == 2: delta, M = 5*w*L**4/(384*E*I), w*L**2/8
elif case == 3: delta, M = P*L**3/(3*E*I), P*L
elif case == 4: delta, M = w*L**4/(8*E*I), w*L**2/2
else: raise ValueError("case must be 1 to 4")
sigma = M * c / I
return {"deflection_mm": delta, "moment_kNm": M / 1e6,
"stress_MPa": sigma, "factor_of_safety": yield_MPa / sigma,
"limit_mm": L / limit_ratio, "deflection_ok": delta <= L / limit_ratio}
# Example 1: S275 steel 50 x 100 mm, 2 m span, 5 kN at mid-span
I, c = section_properties("rect", 50, 100)
print(beam(1, 2.0, 5.0, 200, I, c, 275))
# Example 2: 6061-T6 aluminium tube 60 x 4 mm, cantilever 1.2 m, 0.5 kN/m
I, c = section_properties("tube", 60, 52)
print(beam(4, 1.2, 0.5, 69, I, c, 240))

Expected output for example 1: deflection 1.000 mm, moment 2.5 kN·m, stress 30 MPa, factor of safety 9.17. I checked all four formulas against a numerical double integration of the bending moment, and checked the Excel version against the Python results for six different cases. If your numbers differ, the usual causes are mixed units or the wrong case number.

Excel calculator

The Excel version uses drop-downs for the load case, material and section type, and recalculates as you type. It gives the same results as the script. Download the beam deflection calculator (Excel, free, 12 KB). Blue text on cream cells marks the inputs you change; everything else is a formula.

Assumptions and limitations

  • Straight beam, constant cross-section, linear-elastic material, small deflections.
  • Self-weight and shear deflection are ignored. Shear matters for short, deep beams.
  • Bending about the strong axis only. No lateral-torsional buckling, no stress concentrations, no fatigue (see fatigue failure and S-N curves for repeated loads).
  • Material values are typical textbook figures. Check the exact grade and temper on the supplier data sheet.
  • Real structures and safety-critical parts need a design check by a qualified engineer against the applicable standard.

Where to go next

To choose a sensible safety margin, read stress, strain and factor of safety with worked examples. If your beam is a shaft carrying gears, see types of gears and their uses and how to choose a bearing and calculate L10 life, because excess shaft deflection loads the bearings and the gear mesh.

Reviewed October 2026. Formulas from standard strength-of-materials references such as Hibbeler’s Mechanics of Materials and Gere and Goodno’s Mechanics of Materials.


Found this useful? Share it:

Leave a Reply

Keep reading

Discover more from AI and Engineering Insights

Subscribe now to keep reading and get access to the full archive.

Continue reading