body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.calculator-container {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 8px;
padding: 30px;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
margin-bottom: 40px;
}
.calc-header {
text-align: center;
margin-bottom: 25px;
color: #2c3e50;
}
.input-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
@media (max-width: 600px) {
.input-grid {
grid-template-columns: 1fr;
}
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
font-size: 0.9em;
color: #495057;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box; /* Ensures padding doesn't affect width */
}
.form-group input:focus {
border-color: #0056b3;
outline: none;
box-shadow: 0 0 0 3px rgba(0,86,179,0.1);
}
.calc-btn {
width: 100%;
background-color: #0056b3;
color: white;
border: none;
padding: 15px;
font-size: 18px;
font-weight: bold;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.2s;
margin-top: 10px;
}
.calc-btn:hover {
background-color: #004494;
}
.results-container {
margin-top: 25px;
border-top: 2px solid #e9ecef;
padding-top: 20px;
display: none;
}
.result-row {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
font-size: 1.1em;
}
.result-row.total {
font-weight: bold;
color: #0056b3;
font-size: 1.4em;
margin-top: 15px;
border-top: 1px solid #dee2e6;
padding-top: 15px;
}
.article-content {
background: #fff;
padding: 20px 0;
}
.article-content h2 {
color: #2c3e50;
border-bottom: 2px solid #0056b3;
padding-bottom: 10px;
margin-top: 30px;
}
.article-content h3 {
color: #495057;
margin-top: 25px;
}
.article-content ul {
margin-bottom: 20px;
}
.article-content li {
margin-bottom: 8px;
}
.info-box {
background-color: #e7f5ff;
border-left: 4px solid #0056b3;
padding: 15px;
margin: 20px 0;
font-size: 0.95em;
}
function calculateFreightRate() {
// Retrieve inputs using var
var dist = parseFloat(document.getElementById('fr_distance').value);
var rateDist = parseFloat(document.getElementById('fr_rate_per_dist').value);
var weight = parseFloat(document.getElementById('fr_weight').value);
var rateWeight = parseFloat(document.getElementById('fr_rate_per_weight').value);
var fuelPerc = parseFloat(document.getElementById('fr_fuel_surcharge').value);
var extras = parseFloat(document.getElementById('fr_accessorials').value);
// Validation: Default to 0 if inputs are empty/NaN
if (isNaN(dist)) dist = 0;
if (isNaN(rateDist)) rateDist = 0;
if (isNaN(weight)) weight = 0;
if (isNaN(rateWeight)) rateWeight = 0;
if (isNaN(fuelPerc)) fuelPerc = 0;
if (isNaN(extras)) extras = 0;
// Validation Alert
if (dist === 0 && weight === 0) {
alert("Please enter at least a distance or a weight to calculate freight costs.");
return;
}
// Logic Implementation
// 1. Calculate Linehaul (Distance based)
var linehaulCost = dist * rateDist;
// 2. Calculate Weight based cost (if applicable – often used in LTL or Air, less in FTL)
var weightCost = weight * rateWeight;
// 3. Subtotal for Fuel Calculation
// Fuel surcharges typically apply to the linehaul charge.
// Sometimes they apply to weight charges too, depending on the contract.
// We will apply it to the base transport cost (Linehaul + Weight Cost).
var transportBase = linehaulCost + weightCost;
var fuelCost = transportBase * (fuelPerc / 100);
// 4. Total Calculation
var totalCost = transportBase + fuelCost + extras;
// 5. Derived Metric: Cost Per Mile/Km
var costPerDist = 0;
if (dist > 0) {
costPerDist = totalCost / dist;
}
// Output Display
document.getElementById('res_linehaul').innerHTML = "$" + linehaulCost.toFixed(2);
document.getElementById('res_weight').innerHTML = "$" + weightCost.toFixed(2);
document.getElementById('res_accessorials').innerHTML = "$" + extras.toFixed(2);
document.getElementById('res_fuel').innerHTML = "$" + fuelCost.toFixed(2);
document.getElementById('res_total').innerHTML = "$" + totalCost.toFixed(2);
document.getElementById('res_cpm').innerHTML = "$" + costPerDist.toFixed(2);
// Show results container
document.getElementById('results').style.display = 'block';
}
How to Calculate Road Freight Rates
Calculating road freight rates accurately is essential for logistics managers, owner-operators, and supply chain professionals. Unlike simple parcel shipping, road freight (both FTL and LTL) involves multiple variables that impact the final price. This guide breaks down the physics and financial logic behind these calculations.
Quick Note: Road freight pricing often varies between Full Truckload (FTL) and Less Than Truckload (LTL). FTL is primarily driven by distance and market demand, while LTL is heavily influenced by weight, density, and freight class.
1. The Linehaul Charge (Distance)
The foundation of most road freight quotes is the linehaul rate. This is calculated by multiplying the total distance of the trip by a specific rate per mile or kilometer. This rate fluctuates based on lane balances (headhaul vs. backhaul), seasonality, and equipment availability.
Formula: Total Miles × Rate Per Mile = Linehaul Cost
2. Weight and Dimensional Metrics
While FTL shipments usually have a flat linehaul rate up to the legal weight limit (approx. 45,000 lbs in the US), LTL rates use weight and density ("cwt" or cents per hundredweight). If your cargo is light but takes up significant trailer space, carriers may apply "Volumetric Weight" or "DIM Weight" pricing.
- Actual Weight: The physical weight of the goods on the scale.
- Volumetric Weight: Calculated as (Length × Width × Height) / Divisor.
- Chargeable Weight: The carrier will charge based on whichever is higher: the actual weight or the volumetric weight.
3. Understanding Fuel Surcharges (FSC)
Fuel prices are volatile. To protect carriers from price spikes, a Fuel Surcharge (FSC) is added on top of the base rate. This is typically expressed as a percentage of the linehaul cost and is pegged to national diesel price indexes (such as the DOE index in the US).
Example: If your Linehaul is $1,000 and the FSC is 15%, you pay an additional $150 for fuel.
4. Accessorials and Additional Fees
Base rates cover the driving from dock to dock. Any service required beyond simple driving incurs "Accessorial Fees." Common examples include:
- Liftgate Service: Required if the receiver does not have a loading dock.
- Detention/Demurrage: Charges applied if the driver is kept waiting at the loading/unloading facility longer than the allotted free time (usually 2 hours).
- Hazmat Fees: Extra charges for transporting hazardous materials due to insurance and regulation compliance.
5. How to Use This Calculator
To get an estimated freight cost using the tool above:
- Enter Distance: Input the total miles or kilometers for the route.
- Input Base Rate: Enter the current market rate per mile/km.
- Add Weight Factors: If your contract charges by weight (common in LTL), enter the weight and the rate per unit (e.g., per lb or kg). If you are shipping FTL at a flat mile rate, you can leave the weight rate as 0.
- Apply Fuel Surcharge: Enter the current FSC percentage provided by your carrier.
- Include Extras: Sum up any known accessorials (tolls, lumper fees, insurance) and enter them in the last field.