Rim Calculator

Rim Calculator: Calculate Wheel Offset and Backspacing :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ddd; –card-background: #fff; –shadow: 0 2px 5px rgba(0,0,0,0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 1000px; margin: 20px auto; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(–border-color); } header h1 { color: var(–primary-color); margin-bottom: 10px; } .calculator-section { margin-bottom: 40px; padding: 30px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } .calculator-section h2 { color: var(–primary-color); text-align: center; margin-bottom: 25px; } .loan-calc-container { display: flex; flex-direction: column; gap: 20px; } .input-group { display: flex; flex-direction: column; gap: 8px; } .input-group label { font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px; border: 1px solid var(–border-color); border-radius: 5px; font-size: 1rem; width: 100%; box-sizing: border-box; } .input-group input[type="number"]:focus, .input-group input[type="text"]:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85rem; color: #666; } .error-message { color: red; font-size: 0.8rem; margin-top: 5px; min-height: 1.2em; /* Prevent layout shift */ } .button-group { display: flex; gap: 15px; margin-top: 25px; justify-content: center; flex-wrap: wrap; } button { padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 1rem; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; } button.primary { background-color: var(–primary-color); color: white; } button.primary:hover { background-color: #003366; transform: translateY(-1px); } button.secondary { background-color: #6c757d; color: white; } button.secondary:hover { background-color: #5a6268; transform: translateY(-1px); } button.reset { background-color: #ffc107; color: #212529; } button.reset:hover { background-color: #e0a800; transform: translateY(-1px); } .results-container { margin-top: 30px; padding: 25px; background-color: var(–primary-color); color: white; border-radius: 8px; text-align: center; box-shadow: var(–shadow); } .results-container h3 { margin-top: 0; margin-bottom: 15px; font-size: 1.4rem; } .main-result { font-size: 2.5rem; font-weight: bold; margin-bottom: 15px; display: inline-block; padding: 10px 20px; background-color: var(–success-color); border-radius: 5px; } .intermediate-results { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; } .intermediate-results div { text-align: center; } .intermediate-results span { display: block; font-size: 1.8rem; font-weight: bold; } .intermediate-results p { font-size: 0.9rem; margin-bottom: 0; } .formula-explanation { font-size: 0.9rem; font-style: italic; color: rgba(255, 255, 255, 0.8); margin-top: 15px; } .chart-container { margin-top: 30px; padding: 25px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); text-align: center; } .chart-container h3 { color: var(–primary-color); margin-bottom: 20px; } canvas { max-width: 100%; height: auto; } .table-container { margin-top: 30px; padding: 25px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); overflow-x: auto; } .table-container h3 { color: var(–primary-color); text-align: center; margin-bottom: 20px; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(–border-color); } th { background-color: var(–primary-color); color: white; font-weight: bold; } td { background-color: var(–card-background); } tr:hover { background-color: #e9ecef; } caption { font-size: 1.1rem; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; caption-side: top; text-align: left; } .article-section { margin-top: 40px; padding: 30px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } .article-section h2, .article-section h3 { color: var(–primary-color); margin-bottom: 15px; } .article-section h2 { text-align: center; margin-bottom: 30px; } .article-section p, .article-section ul, .article-section ol { margin-bottom: 15px; } .article-section ul, .article-section ol { padding-left: 25px; } .article-section li { margin-bottom: 8px; } .faq-item { margin-bottom: 15px; border-left: 3px solid var(–primary-color); padding-left: 15px; } .faq-item strong { display: block; color: var(–primary-color); margin-bottom: 5px; } .internal-links { margin-top: 30px; padding: 25px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } .internal-links h3 { color: var(–primary-color); text-align: center; margin-bottom: 20px; } .internal-links ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; } .internal-links li { margin-bottom: 10px; } .internal-links a { color: var(–primary-color); text-decoration: none; font-weight: bold; padding: 8px 15px; border: 1px solid var(–primary-color); border-radius: 5px; transition: background-color 0.3s ease, color 0.3s ease; } .internal-links a:hover { background-color: var(–primary-color); color: white; } .internal-links span { display: block; font-size: 0.85rem; color: #666; margin-top: 5px; } @media (min-width: 768px) { .loan-calc-container { flex-direction: row; flex-wrap: wrap; justify-content: space-between; } .loan-calc-container .input-group { width: calc(50% – 10px); /* Two columns on larger screens */ } .button-group { width: 100%; justify-content: center; } .intermediate-results { justify-content: space-around; } } @media (min-width: 992px) { .loan-calc-container .input-group { width: calc(33.333% – 14px); /* Three columns on larger screens */ } }

Rim Calculator: Offset, Backspacing & More

Calculate critical wheel fitment dimensions to ensure your new rims fit perfectly.

Wheel Rim Fitment Calculator

The overall diameter of the wheel rim.
The width of the rim from bead seat to bead seat.
e.g., for 5×114.3, this is 5.
e.g., for 5×114.3, this is 114.3.
Distance from the wheel's mounting surface to its centerline (positive or negative).
The widest point of the tire.
Tire sidewall height as a percentage of tire width.
Minimum clearance needed for brake components.

Fitment Analysis

Backspacing (in)

Positive Offset (mm)

Negative Offset (mm)

Backspacing (in) = (Rim Width (in) / 2) + Offset (mm) / 25.4
Tire Diameter (in) = (Tire Width (mm) * Aspect Ratio (%) / 100) * 2 / 25.4 + Rim Diameter (in)
Clearance Check = Tire Diameter (in) / 2 + Brake Clearance (in) – (Rim Width (in) / 2 + Offset (mm) / 25.4)
Key Assumptions:

Bolt Pattern:

Tire Profile:

Wheel Clearance Visualization

Visualizing inner and outer clearance relative to the hub mounting surface.

Fitment Parameters Summary

Key Rim and Tire Dimensions
Parameter Value Unit
Rim Diameter inches
Rim Width inches
Offset mm
Tire Width mm
Aspect Ratio %
Calculated Backspacing inches
Calculated Tire Diameter inches

What is a Rim Calculator?

A rim calculator, often referred to as a wheel offset calculator or backspacing calculator, is an essential tool for automotive enthusiasts, mechanics, and anyone looking to customize their vehicle's wheels. It helps determine how a new set of rims will fit on a specific vehicle by calculating critical dimensions like wheel offset, backspacing, and overall tire diameter. Understanding these measurements is crucial to avoid clearance issues with suspension components, fenders, and brake systems, ensuring both aesthetic appeal and safe operation. This rim calculator simplifies complex geometric calculations, making wheel selection more accessible.

Who should use it?

  • Vehicle owners planning to upgrade their wheels and tires.
  • Custom car builders and modifiers.
  • Mechanics and tire shop professionals.
  • Anyone curious about how different wheel specifications affect vehicle fitment.

Common misconceptions about rim fitment include:

  • Assuming all wheels with the same bolt pattern will fit without modification.
  • Believing that a larger rim diameter automatically means a larger overall tire diameter.
  • Underestimating the importance of wheel offset and backspacing for clearance.
  • Ignoring brake caliper clearance, especially with larger aftermarket brakes.

Our advanced rim calculator addresses these concerns by providing detailed insights into wheel fitment.

Rim Calculator Formula and Mathematical Explanation

The core function of a rim calculator revolves around a few key geometric principles. It translates user-provided rim and tire specifications into critical fitment dimensions. The primary calculations involve determining backspacing, and then using that to infer potential clearance issues, especially when comparing to stock or alternative setups.

Backspacing Calculation

Backspacing is the distance from the inner mounting surface of the wheel (where it bolts to the hub) to the outer lip of the wheel. It's a critical measurement for determining how far inward the wheel sits relative to the vehicle's suspension and bodywork.

The formula is:

Backspacing (inches) = (Rim Width (inches) / 2) + (Offset (mm) / 25.4)

Explanation of Variables:

Variables Used in Backspacing Calculation
Variable Meaning Unit Typical Range
Rim Width The width of the wheel rim, measured between the bead seats. inches 4.0 – 12.0+
Offset The distance from the wheel's mounting surface to its centerline. Positive offset means the mounting surface is closer to the outside of the wheel; negative offset means it's closer to the inside. mm -50 to +70 (varies greatly by vehicle)
25.4 Conversion factor from millimeters to inches. mm/inch Constant

Tire Diameter Calculation

The overall diameter of the tire is crucial for understanding how it interacts with fenders and suspension components, especially when turning or compressing the suspension.

The formula is:

Tire Diameter (inches) = (Tire Width (mm) * Aspect Ratio (%) / 100) * 2 / 25.4 + Rim Diameter (inches)

Explanation of Variables:

Variables Used in Tire Diameter Calculation
Variable Meaning Unit Typical Range
Tire Width The maximum width of the tire. mm 155 – 335+
Aspect Ratio The sidewall height of the tire as a percentage of its width. % 25 – 80
Rim Diameter The diameter of the wheel rim. inches 13 – 26+
25.4 Conversion factor from millimeters to inches. mm/inch Constant

Clearance Check (Simplified)

A basic clearance check can be approximated by comparing the calculated backspacing and tire diameter against known safe limits or stock specifications. Our calculator provides a simplified status based on common fitment guidelines and brake clearance input.

Clearance Check = Tire Diameter (in) / 2 + Brake Clearance (in) - Backspacing (in)

A positive result generally indicates more clearance, while a negative result suggests potential issues. The calculator provides a qualitative status (e.g., "Likely Fits", "Potential Rubbing").

Practical Examples (Real-World Use Cases)

Let's explore how our rim calculator can be used in practical scenarios.

Example 1: Upgrading to Wider Rims on a Sedan

Scenario: A driver wants to fit wider, more aggressive-looking rims on their 2020 Honda Civic. They are considering 18×8.5 inch rims with a +35mm offset, paired with 235/40R18 tires. The stock setup is 17×7 inch rims with 215/50R17 tires and an offset of +45mm. They need to ensure clearance, especially with potential suspension modifications.

Inputs for the Calculator:

  • Rim Diameter: 18 inches
  • Rim Width: 8.5 inches
  • Offset: 35 mm
  • Bolt Pattern: 5×114.3 (assumed common for Civic)
  • Tire Width: 235 mm
  • Aspect Ratio: 40 %
  • Brake Clearance: 1.2 inches (estimated needed clearance)

Calculator Outputs:

  • Calculated Backspacing: 7.28 inches
  • Calculated Tire Diameter: 26.2 inches
  • Fitment Status: Likely Fits (with minor caveats)

Financial Interpretation: The new rims have a lower offset (+35mm vs +45mm), meaning they will sit further out by 10mm. The wider rim and tire also increase the overall width. The calculated backspacing of 7.28 inches is slightly less than the stock setup (approx. 6.7 inches for 17×7 +45mm), indicating the wheel sits further inboard relative to the hub. The tire diameter is slightly larger (26.2 vs 25.7 inches). This setup is generally safe, but the driver should be mindful of potential rubbing on the fender liner during full suspension compression or sharp turns, especially if the suspension is lowered. The increased track width can improve handling but may require fender liner modification for aggressive driving.

Example 2: Off-Road Truck Wheel Upgrade

Scenario: An owner of a 2018 Ford F-150 wants to install larger, more rugged wheels for off-roading. They are looking at 17×9 inch rims with a -12mm offset, paired with 33×12.5R17 tires. The stock setup is 17×7.5 inch rims with 265/70R17 tires and a +44mm offset.

Inputs for the Calculator:

  • Rim Diameter: 17 inches
  • Rim Width: 9 inches
  • Offset: -12 mm
  • Bolt Pattern: 6×135 (assumed common for F-150)
  • Tire Width: 12.5 inches (converted to mm: 12.5 * 25.4 = 317.5 mm)
  • Aspect Ratio: Not directly applicable for "33×12.5″ sizing, but we can estimate based on diameter. For calculation, we'll use the tire diameter directly if possible, or approximate. Let's assume a standard aspect ratio for a 33″ tire, roughly 33 / 12.5 * 100 = ~84%. However, the calculator uses width and aspect ratio. Let's use 317.5mm width and an aspect ratio that yields ~33″ diameter. A 317.5/70R17 tire would be ~31.7". Let's use 317.5mm width and 70 aspect ratio for calculation purposes, yielding ~31.7″ diameter. For a true 33″ diameter, a 317.5/75R17 might be closer. Let's use 317.5mm width and 75 aspect ratio.
  • Brake Clearance: 1.8 inches (standard for many trucks)

Calculator Outputs (using 317.5mm width, 75 aspect ratio):

  • Calculated Backspacing: 4.53 inches
  • Calculated Tire Diameter: 32.7 inches
  • Fitment Status: Likely Fits (with fender modifications likely needed)

Financial Interpretation: This setup significantly increases the vehicle's track width. The negative offset (-12mm vs +44mm) pushes the wheel out by 56mm. The wider rim and much wider tire (317.5mm vs 265mm) will extend considerably beyond the stock fenders. The backspacing is reduced (4.53 vs ~6.5 inches stock), meaning the wheel is much closer to the suspension components. The tire diameter is larger (32.7 vs ~31.6 inches stock). This aggressive stance is common for off-road trucks but will almost certainly require fender flares or trimming to prevent rubbing, especially when the suspension articulates or the steering is turned. The owner must budget for potential body modifications and ensure the suspension can handle the increased leverage.

How to Use This Rim Calculator

Using our rim calculator is straightforward. Follow these steps to get accurate fitment information:

  1. Gather Vehicle and Wheel Information: You'll need the specifications for both your vehicle's current wheel setup (or desired stock specs) and the new rims and tires you are considering.
  2. Input Rim Specifications:
    • Rim Diameter: Enter the diameter of the wheel in inches (e.g., 17, 18, 20).
    • Rim Width: Enter the width of the wheel in inches (e.g., 7.5, 8, 9).
    • Offset: Enter the wheel offset in millimeters (mm). Use a positive value for positive offset (e.g., +35) and a negative value for negative offset (e.g., -12).
    • Bolt Pattern: Enter the number of lug holes (Numerator) and the diameter of the bolt circle in millimeters (Denominator) (e.g., 5×114.3).
  3. Input Tire Specifications:
    • Tire Width: Enter the width of the tire in millimeters (mm) (e.g., 215, 235, 275).
    • Aspect Ratio: Enter the tire's aspect ratio as a percentage (%) (e.g., 45, 50, 55). This is the sidewall height relative to the tire width.
  4. Input Clearance Needs:
    • Brake Clearance: Estimate the minimum clearance (in inches) required between the wheel and the brake caliper/components. This is crucial for performance and safety.
  5. Calculate: Click the "Calculate Fitment" button.
  6. Review Results: The calculator will display:
    • Calculated Backspacing: The distance from the hub mounting surface to the inner edge of the rim.
    • Calculated Tire Diameter: The overall diameter of the tire mounted on the rim.
    • Fitment Status: A general assessment (e.g., "Likely Fits", "Potential Rubbing", "Check Clearance").
    • Key Assumptions: Details about the bolt pattern and tire profile used in calculations.
  7. Interpret the Data: Use the results to understand how the new wheels will fit. Compare the calculated backspacing and tire diameter to your vehicle's stock specifications or known safe limits. Pay close attention to the fitment status and consider the required brake clearance.
  8. Make Informed Decisions: Use this information to confidently select wheels and tires that will fit your vehicle without causing costly damage or compromising safety. If the calculator indicates potential issues, consult with a professional wheel and tire specialist.
  9. Reset: Click "Reset Defaults" to clear the form and start over with standard values.
  10. Copy Results: Click "Copy Results" to copy the calculated values and assumptions to your clipboard for easy sharing or record-keeping.

Key Factors That Affect Rim Calculator Results

While a rim calculator provides valuable insights, several real-world factors can influence actual wheel and tire fitment. Understanding these is key to a successful modification:

  1. Vehicle-Specific Suspension Geometry: Reasoning: Different vehicles have unique suspension designs (e.g., MacPherson strut, double-wishbone, multi-link). This affects the available space around the wheel well, especially at full steering lock or suspension compression. A calculator provides a baseline, but the actual clearance can vary significantly based on the suspension type and its travel range.
  2. Tire Sidewall Stiffness and Actual Dimensions: Reasoning: Tire manufacturers' stated dimensions can vary slightly. Furthermore, the aspect ratio is a percentage of width, but the actual tire profile (roundness of the sidewall) can differ between brands and models. A "square" tire might rub differently than a "rounder" one, even with the same calculated diameter.
  3. Fender Liner and Trim Variations: Reasoning: Factory fender liners and plastic trim pieces can intrude into the wheel well. Aggressive wheel fitments might require removing, trimming, or modifying these components. The calculator doesn't account for these specific plastic parts.
  4. Aftermarket Suspension Components: Reasoning: If you have installed aftermarket coilovers, lowering springs, lift kits, or control arms, the geometry and available space around the wheel can change dramatically. These modifications often require re-evaluation of wheel fitment beyond standard calculator outputs.
  5. Wheel Construction and Design: Reasoning: The inner barrel design of a wheel can vary. Some wheels have more concave spokes or thicker inner lips, which can affect clearance with suspension components like control arms or struts, even if the offset and backspacing appear suitable on paper.
  6. Tire Wear and Load: Reasoning: Over time, tires can wear unevenly. Also, carrying heavy loads can cause the suspension to sag slightly, reducing the gap between the tire and the fender. While not directly part of the calculation, these factors influence real-world clearance.
  7. Brake System Upgrades: Reasoning: As mentioned in the calculator, larger aftermarket brake kits (rotors and calipers) require significantly more clearance. Always verify that the chosen wheel has enough room for the specific brake system installed or planned. Our rim calculator includes a field for this critical input.
  8. Hub Centric Rings and Lug Nuts: Reasoning: While not affecting the core fitment dimensions, using the correct hub-centric rings (to center the wheel on the hub) and lug nuts (tapered or ball-seated) is vital for safe installation and to prevent vibrations.

Frequently Asked Questions (FAQ)

Q1: What is the most important measurement for wheel fitment?

A: While all measurements are important, wheel offset and backspacing are critical for determining how the wheel sits in the wheel well and avoiding rubbing against suspension components or fenders. Tire diameter is also crucial for overall clearance.

Q2: Can I use a rim calculator to determine if larger brakes will fit?

A: Yes, our rim calculator includes a brake clearance input. You need to know the required clearance for your specific brake kit and input it to get a better idea of fitment. However, always double-check with the brake kit manufacturer's specifications.

Q3: My new wheels rub slightly. What should I do?

A: Minor rubbing, especially on the fender liner during full lock or suspension compression, might be resolved by trimming the fender liner or adjusting suspension alignment. More significant rubbing may require different wheel offsets, narrower tires, or even fender modifications. Consult a professional.

Q4: Does bolt pattern matter more than offset?

A: Both are critical. The bolt pattern ensures the wheel physically bolts onto the hub correctly. Offset determines the wheel's position within the wheel well. A wheel with the correct bolt pattern but incorrect offset will likely not fit properly and could cause damage.

Q5: What does a negative offset mean?

A: A negative offset means the wheel's mounting surface is positioned inboard (towards the suspension) relative to the wheel's centerline. This pushes the wheel further out from the hub assembly, increasing the track width. It's common on trucks and performance cars for aesthetic or clearance reasons.

Q6: How does tire aspect ratio affect fitment?

A: The aspect ratio determines the tire's sidewall height. A lower aspect ratio (e.g., 35) means a shorter sidewall and a smaller overall tire diameter for a given width and rim size, which can help prevent fender rubbing. A higher aspect ratio results in a taller sidewall and larger diameter.

Q7: Can I mix different wheel sizes on my car?

A: It is generally not recommended to mix different wheel sizes (diameter, width, offset) on the same axle, and often not recommended across different axles unless specifically designed for by the manufacturer (e.g., some sports cars). This can negatively affect handling, stability control systems (ABS, traction control), and tire wear.

Q8: How accurate is this rim calculator?

A: This rim calculator uses standard formulas for high accuracy based on the inputs provided. However, real-world fitment can be affected by variations in tire manufacturing, aftermarket suspension components, and specific vehicle tolerances. Always use the calculator as a guide and consult with professionals for critical applications.

© 2023 Your Website Name. All rights reserved.

var rimDiameterInput = document.getElementById('rimDiameter'); var rimWidthInput = document.getElementById('rimWidth'); var boltPatternNumeratorInput = document.getElementById('boltPatternNumerator'); var boltPatternDenominatorInput = document.getElementById('boltPatternDenominator'); var offsetInput = document.getElementById('offset'); var tireWidthInput = document.getElementById('tireWidth'); var aspectRatioInput = document.getElementById('aspectRatio'); var brakeClearanceInput = document.getElementById('brakeClearance'); var rimDiameterError = document.getElementById('rimDiameterError'); var rimWidthError = document.getElementById('rimWidthError'); var boltPatternNumeratorError = document.getElementById('boltPatternNumeratorError'); var boltPatternDenominatorError = document.getElementById('boltPatternDenominatorError'); var offsetError = document.getElementById('offsetError'); var tireWidthError = document.getElementById('tireWidthError'); var aspectRatioError = document.getElementById('aspectRatioError'); var brakeClearanceError = document.getElementById('brakeClearanceError'); var resultsSection = document.getElementById('resultsSection'); var calculatedBackspacingSpan = document.getElementById('calculatedBackspacing'); var calculatedPositiveOffsetSpan = document.getElementById('calculatedPositiveOffset'); var calculatedNegativeOffsetSpan = document.getElementById('calculatedNegativeOffset'); var fitmentStatusDiv = document.getElementById('fitmentStatus'); var assumptionBoltPatternSpan = document.getElementById('assumptionBoltPattern'); var assumptionTireProfileSpan = document.getElementById('assumptionTireProfile'); var summaryRimDiameterTd = document.getElementById('summaryRimDiameter'); var summaryRimWidthTd = document.getElementById('summaryRimWidth'); var summaryOffsetTd = document.getElementById('summaryOffset'); var summaryTireWidthTd = document.getElementById('summaryTireWidth'); var summaryAspectRatioTd = document.getElementById('summaryAspectRatio'); var summaryBackspacingTd = document.getElementById('summaryBackspacing'); var summaryTireDiameterTd = document.getElementById('summaryTireDiameter'); var clearanceChart = null; var chartContext = null; function validateInput(inputElement, errorElement, minValue, maxValue, isRequired = true) { var value = inputElement.value.trim(); var errorMsg = "; if (isRequired && value === ") { errorMsg = 'This field is required.'; } else if (value !== ") { var numValue = parseFloat(value); if (isNaN(numValue)) { errorMsg = 'Please enter a valid number.'; } else { if (minValue !== undefined && numValue maxValue) { errorMsg = 'Value cannot be greater than ' + maxValue + '.'; } } } if (errorElement) { errorElement.textContent = errorMsg; } return errorMsg === "; } function calculateRimFitment() { var isValid = true; isValid &= validateInput(rimDiameterInput, rimDiameterError, 1); isValid &= validateInput(rimWidthInput, rimWidthError, 1); isValid &= validateInput(boltPatternNumeratorInput, boltPatternNumeratorError, 1); isValid &= validateInput(boltPatternDenominatorInput, boltPatternDenominatorError, 1); isValid &= validateInput(offsetInput, offsetError); // Offset can be negative isValid &= validateInput(tireWidthInput, tireWidthError, 1); isValid &= validateInput(aspectRatioInput, aspectRatioError, 1, 100); isValid &= validateInput(brakeClearanceInput, brakeClearanceError, 0); if (!isValid) { resultsSection.style.display = 'none'; return; } var rimDiameter = parseFloat(rimDiameterInput.value); var rimWidth = parseFloat(rimWidthInput.value); var boltPatternNumerator = parseFloat(boltPatternNumeratorInput.value); var boltPatternDenominator = parseFloat(boltPatternDenominatorInput.value); var offset = parseFloat(offsetInput.value); var tireWidth = parseFloat(tireWidthInput.value); var aspectRatio = parseFloat(aspectRatioInput.value); var brakeClearance = parseFloat(brakeClearanceInput.value); // Calculations var rimWidthHalf = rimWidth / 2; var offsetInches = offset / 25.4; var calculatedBackspacing = rimWidthHalf + offsetInches; var tireSidewallHeight = (tireWidth * aspectRatio) / 100; var tireDiameter = (tireSidewallHeight * 2) / 25.4 + rimDiameter; var clearanceCheckValue = (tireDiameter / 2) + brakeClearance – calculatedBackspacing; var fitmentStatus = ""; if (clearanceCheckValue > 0.5) { // Generous clearance fitmentStatus = "Excellent Fit"; } else if (clearanceCheckValue > -0.2) { // Tight but likely okay fitmentStatus = "Likely Fits"; } else if (clearanceCheckValue > -1.0) { // Potential rubbing fitmentStatus = "Potential Rubbing"; } else { // Significant issues fitmentStatus = "Check Clearance Carefully"; } // Display Results calculatedBackspacingSpan.textContent = calculatedBackspacing.toFixed(2); calculatedPositiveOffsetSpan.textContent = offset > 0 ? offset.toFixed(0) : '–'; calculatedNegativeOffsetSpan.textContent = offset < 0 ? Math.abs(offset).toFixed(0) : '–'; fitmentStatusDiv.textContent = fitmentStatus; fitmentStatusDiv.style.backgroundColor = (fitmentStatus === "Excellent Fit" || fitmentStatus === "Likely Fits") ? 'var(–success-color)' : '#dc3545'; assumptionBoltPatternSpan.textContent = boltPatternNumerator + "x" + boltPatternDenominator.toFixed(1); assumptionTireProfileSpan.textContent = tireWidth + "/" + aspectRatio + "R" + rimDiameter.toFixed(0); summaryRimDiameterTd.textContent = rimDiameter.toFixed(1); summaryRimWidthTd.textContent = rimWidth.toFixed(1); summaryOffsetTd.textContent = offset.toFixed(0); summaryTireWidthTd.textContent = tireWidth.toFixed(0); summaryAspectRatioTd.textContent = aspectRatio.toFixed(0); summaryBackspacingTd.textContent = calculatedBackspacing.toFixed(2); summaryTireDiameterTd.textContent = tireDiameter.toFixed(2); resultsSection.style.display = 'block'; updateChart(calculatedBackspacing, tireDiameter, brakeClearance, rimWidth); } function resetForm() { rimDiameterInput.value = '17'; rimWidthInput.value = '8'; boltPatternNumeratorInput.value = '5'; boltPatternDenominatorInput.value = '114.3'; offsetInput.value = '35'; tireWidthInput.value = '225'; aspectRatioInput.value = '45'; brakeClearanceInput.value = '1.5'; rimDiameterError.textContent = ''; rimWidthError.textContent = ''; boltPatternNumeratorError.textContent = ''; boltPatternDenominatorError.textContent = ''; offsetError.textContent = ''; tireWidthError.textContent = ''; aspectRatioError.textContent = ''; brakeClearanceError.textContent = ''; resultsSection.style.display = 'none'; if (chartContext) { chartContext.clearRect(0, 0, chartContext.canvas.width, chartContext.canvas.height); } } function copyResults() { var resultsText = "— Rim Fitment Analysis —\n\n"; resultsText += "Fitment Status: " + fitmentStatusDiv.textContent + "\n"; resultsText += "Calculated Backspacing: " + calculatedBackspacingSpan.textContent + " inches\n"; resultsText += "Positive Offset: " + calculatedPositiveOffsetSpan.textContent + " mm\n"; resultsText += "Negative Offset: " + calculatedNegativeOffsetSpan.textContent + " mm\n\n"; resultsText += "Key Assumptions:\n"; resultsText += "- Bolt Pattern: " + assumptionBoltPatternSpan.textContent + "\n"; resultsText += "- Tire Profile: " + assumptionTireProfileSpan.textContent + "\n\n"; resultsText += "— Input Parameters —\n"; resultsText += "Rim Diameter: " + rimDiameterInput.value + " inches\n"; resultsText += "Rim Width: " + rimWidthInput.value + " inches\n"; resultsText += "Offset: " + offsetInput.value + " mm\n"; resultsText += "Tire Width: " + tireWidthInput.value + " mm\n"; resultsText += "Aspect Ratio: " + aspectRatioInput.value + " %\n"; resultsText += "Brake Clearance: " + brakeClearanceInput.value + " inches\n"; try { var textArea = document.createElement("textarea"); textArea.value = resultsText; textArea.style.position = "fixed"; textArea.style.left = "-9999px"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); document.execCommand("copy"); document.body.removeChild(textArea); alert("Results copied to clipboard!"); } catch (err) { alert("Failed to copy results. Please copy manually."); } } function updateChart(backspacing, tireDiameter, brakeClearance, rimWidth) { var canvas = document.getElementById('clearanceChart'); if (!chartContext) { chartContext = canvas.getContext('2d'); } chartContext.clearRect(0, 0, canvas.width, canvas.height); // Clear previous drawing var centerX = canvas.width / 2; var centerY = canvas.height / 2; var radiusScale = Math.min(centerX, centerY) / 15; // Scale radius based on canvas size // Draw Hub Mounting Surface (center) chartContext.fillStyle = '#6c757d'; // Grey chartContext.beginPath(); chartContext.arc(centerX, centerY, 10, 0, Math.PI * 2); chartContext.fill(); // Draw Rim Inner Edge (based on backspacing) var rimInnerRadius = backspacing * 25.4 / 2 * radiusScale; // Convert backspacing to pixels chartContext.fillStyle = '#004a99'; // Primary Blue chartContext.beginPath(); chartContext.arc(centerX, centerY, rimInnerRadius, 0, Math.PI * 2); chartContext.fill(); // Draw Tire Outer Edge (based on tire diameter) var tireOuterRadius = (tireDiameter / 2) * radiusScale; chartContext.fillStyle = '#28a745'; // Success Green chartContext.beginPath(); chartContext.arc(centerX, centerY, tireOuterRadius, 0, Math.PI * 2); chartContext.fill(); // Draw Brake Clearance Indicator (visual approximation) var brakeClearanceRadius = (backspacing + brakeClearance) * 25.4 / 2 * radiusScale; chartContext.strokeStyle = '#ffc107'; // Warning Yellow chartContext.lineWidth = 2; chartContext.beginPath(); chartContext.arc(centerX, centerY, brakeClearanceRadius, 0, Math.PI * 2); chartContext.stroke(); // Add labels (simplified) chartContext.fillStyle = '#333'; chartContext.font = '12px Arial'; chartContext.textAlign = 'center'; // Rim Inner Edge Label chartContext.fillText('Rim Inner', centerX, centerY – rimInnerRadius – 10); // Tire Outer Edge Label chartContext.fillText('Tire Outer', centerX, centerY + tireOuterRadius + 15); // Brake Clearance Indicator Label chartContext.fillText('Brake Clearance', centerX, centerY + brakeClearanceRadius + 15); } // Initial calculation on load if default values are present document.addEventListener('DOMContentLoaded', function() { calculateRimFitment(); // Ensure chart canvas is sized appropriately if needed, though CSS handles it here. var canvas = document.getElementById('clearanceChart'); canvas.width = canvas.parentElement.offsetWidth * 0.9; // Adjust canvas width to container canvas.height = canvas.width * 0.75; // Maintain aspect ratio updateChart( parseFloat(rimWidthInput.value)/2 + parseFloat(offsetInput.value)/25.4, (parseFloat(tireWidthInput.value) * parseFloat(aspectRatioInput.value) / 100) * 2 / 25.4 + parseFloat(rimDiameterInput.value), parseFloat(brakeClearanceInput.value), parseFloat(rimWidthInput.value) ); }); // Re-calculate chart size on window resize window.addEventListener('resize', function() { var canvas = document.getElementById('clearanceChart'); if (canvas && canvas.parentElement) { canvas.width = canvas.parentElement.offsetWidth * 0.9; canvas.height = canvas.width * 0.75; calculateRimFitment(); // Recalculate and redraw chart } });

Leave a Comment