RC beam designer
A program that takes a beam's span, loads and material grades and carries out the full IS 456 design of a singly reinforced rectangular section: section sizing, effective span, factored loads, moment and shear, tension steel, stirrups and the deflection check, then draws the reinforcement. Written in Python for an intra-department competition, where it placed third; revised in 2026 with the corrections listed on sheet S-414 and ported to run live on this page.
Design a beam
Change any input and the calculation sheet and drawing update. Every number comes from the same functions as the Python file, so the two agree to the decimal. Print the page to get a clean calc sheet.
Design sequence
The program follows the hand-calculation order taught for IS 456, so its output reads like a calc sheet a checker would recognise.
What the review changed
The competition entry produced the right numbers for the textbook case it was written against. Reviewing it three years on with more design experience turned up the gaps below, all fixed in the revised code.
| Item | Competition version (2023) | Revised version (2026) |
|---|---|---|
| Steel grades | Branches on fy = 450, so Fe415 crashed before the depth check. | FixedFe250, Fe415 and Fe500 with their own k and xu,max/d values. |
| Loads | A 3 kN/m live load was added inside the code on top of the user's imposed load; the prompt asked for N/mm but treated the value as N/m. | FixedOnly what the user enters, in kN/m, with an optional finishes line. Units are consistent end to end. |
| Mu vs Mu,lim | Compared in different units and printed "under reinforced" on both branches. | FixedCorrect comparison; when Mu exceeds Mu,lim the sheet says so and asks for a deeper or doubly reinforced section instead of crashing on a negative square root. |
| Bar count | Cantilever branch did not round up, so provided steel equalled required steel. | FixedWhole bars, user-chosen diameter, minimum and maximum steel checks, one-layer fit check. |
| Shear | Assumed 16 mm stirrups, discarded the computed spacing and always used the 300 mm cap; no τc,max check; negative Vus produced a negative spacing. | Fixedτc,max check from Table 20; minimum stirrups when τv ≤ τc; designed spacing otherwise; stirrup fy capped at 415; final spacing is the least of the three limits, rounded to 10 mm. |
| Tables | SciPy interpolation raised an error outside 0.15% to 3% steel. | FixedClamped linear interpolation in plain Python, no SciPy. |
| Deflection | Cantilever used the simply supported ratio of 20; actual L/d used the clear span. | FixedRatio 7 for cantilevers, effective span throughout, long-span reduction above 10 m, Fig 4 factor from its closed-form expression. |
| Drawing | Plotted fixed coordinates unrelated to the design. | FixedSection and elevation drawn from b, D, bar count and stirrup spacing, in both Python and the page above. |
| Structure | Two near-identical 140-line branches. | ImprovedOne code path with small functions, a JSON mode for testing, and a JavaScript twin verified against it on four cases. |
Source
The design is a handful of pure functions. The tension-steel step, as written in the revised Python:
def flexure(Mu, b, d, D, fck, fy, bar_dia): k = K_LIM[int(fy)] # 0.148 / 0.138 / 0.133 for Fe250 / 415 / 500 Mu_lim = k * fck * b * d * d d_req = math.sqrt(Mu / (k * fck * b)) if Mu > Mu_lim: return {... "singly": False} # deeper or doubly reinforced section # Annex G-1.1 (b) Ast = 0.5 * fck / fy * (1 - math.sqrt(1 - 4.6 * Mu / (fck * b * d * d))) * b * d Ast_min = 0.85 * b * d / fy # cl 26.5.1.1 (a) Ast_max = 0.04 * b * D # cl 26.5.1.1 (b) n = math.ceil(max(Ast, Ast_min) / bar_area(bar_dia)) return {"Ast_req": Ast, "n_bars": n, "Ast_prov": n * bar_area(bar_dia), ...}