Dave's Off-Road Gear Ratio and Tire Size RPM Calculator

Memorialized in 2018
Note
I heartily recommend using this Gear Ratio Calculator on 4lo.com]. It does exactly what mine used to do.

Look at my old tool

I wrote this calculator in the early 2000s to help me figure out the ratio on my '77 K10 Silverado (35" tires and 8" lift, auto trans and NP205 transfer case).

For the interested, I don’t mind sharing my old PHP as long as you keep in mind that in terms of my development as a programmer, it was written back when dinosaurs roamed the earth:

<?php
// You DON'T have this dependency - Darts was my homegrown caching template engine.
// But for this tool, it's not being used for anything that isn't dirt-simple in straight PHP.
require_once("darts.php");
$title="Dave's Off-Road Gear Ratio and Tire Size RPM Calculator";
$description="Calculates the engine RPM range for a vehicle given it's differential gear ratio and tire size.";

$trans = "th350";
$tcase = "none";
$tire =  "35";
$diff =  "3.7";
$crawler = "1";

if(Darts::isWebData("go")){

  $trans   = Darts::webData("trans");
  $tcase   = Darts::webData("tcase");
  $tire    = floatval(Darts::webData("tire"));
  $diff    = floatval(Darts::webData("diff"));
  $crawler = floatval(Darts::webData("crawler"));

  if($tire < 1){ $tire = 1; }

  $results = true;

  // transmissions
  switch($trans)
  {
    case "th350":   $transLo = 2.52; $transHi = 1.00; break; //TH 350
    case "th400":   $transLo = 2.48; $transHi = 1.00; break; //TH 400
    case "th700r4": $transLo = 3.06; $transHi = 0.70; break; //TH 700R4
    case "4l80e":   $transLo = 3.10; $transHi = 0.75; break; //4L80-E
    case "al1000":  $transLo = 3.10; $transHi = 0.71; break; //Allison 1000
    case "c4":      $transLo = 2.46; $transHi = 1.00; break; //C-4
    case "c5":      $transLo = 2.46; $transHi = 1.00; break; //C-5
    case "c6":      $transLo = 2.46; $transHi = 1.00; break; //C-6
    case "aod":     $transLo = 2.40; $transHi = 0.67; break; //Ford AOD
    case "tf727":   $transLo = 2.45; $transHi = 1.00; break; //TorqueFlite 727
    case "amcsr4":  $transLo = 4.07; $transHi = 1.00; break; //AMC SR4
    case "sm420":   $transLo = 7.00; $transHi = 1.00; break; //SM 420
    case "sm465":   $transLo = 6.55; $transHi = 1.00; break; //SM 465
    case "t176":    $transLo = 3.52; $transHi = 1.00; break; //T-176
    case "t177":    $transLo = 3.00; $transHi = 1.00; break; //T-177
    case "t178":    $transLo = 3.00; $transHi = 1.00; break; //T-178
    case "nv3500":  $transLo = 4.02; $transHi = 0.73; break; //NV3500
    case "nv4500":  $transLo = 5.61; $transHi = 0.73; break; //NV4500
    case "zfs6650": $transLo = 5.79; $transHi = 0.76; break; //ZF S6-650
    case "amcsr4":  $transLo = 4.07; $transHi = 1.00; break; //AMC SR4
    default:   $transLo = 2.52; $transHi = 1.00; break; //TH 350
  }

  // transfer cases
  switch($tcase)
  {
    case "none":      $tcaseLo = 1.00; $tcaseHi = 1.00; break; // no tcase
    case "dana300":   $tcaseLo = 2.62; $tcaseHi = 1.00; break; //Dana 300
    case "bw1356":    $tcaseLo = 2.69; $tcaseHi = 1.00; break; //Borg Warner 1356
    case "dspicer18": $tcaseLo = 2.46; $tcaseHi = 1.00; break; //Dana Spicer 18
    case "dspicer20": $tcaseLo = 2.00; $tcaseHi = 1.00; break; //Dana Spicer 20
    case "np203":     $tcaseLo = 2.00; $tcaseHi = 1.00; break; //NP 203
    case "np205":     $tcaseLo = 1.98; $tcaseHi = 1.00; break; //NP 205
    case "np207":     $tcaseLo = 2.61; $tcaseHi = 1.00; break; //NP 207
    case "np208":     $tcaseLo = 2.61; $tcaseHi = 1.00; break; //NP 208
    case "np231":     $tcaseLo = 2.72; $tcaseHi = 1.00; break; //NP 231
    default:      $tcaseLo = 1.00; $tcaseHi = 1.00; break; // no tcase
  }

  if($crawler == "1") $crawler = 1.00;

  $crawl_ratio = round($transLo * $tcaseLo * $crawler * $diff, 2);
  $crawl_table = makeTable($crawl_ratio, $tire, 1, 10);

  $launch_ratio = round($transLo * $tcaseHi * 1.00 * $diff, 2);
  $launch_table = makeTable($launch_ratio, $tire, 1, 15);

  $highway_ratio = round($transHi * $tcaseHi * 1.00 * $diff, 2);
  $highway_table = makeTable($highway_ratio, $tire, 45, 90);
}

function makeTable($totalGears, $tire, $mphStart, $mphEnd)
{
  $table = array();
  for($i=$mphStart; $i<=$mphEnd; $i++)
  {
    // rpm = (mph x (gear ratio) x 336) / tire diameter
    $rpm = ($i * $totalGears * 336) / $tire;
    $rpm = round($rpm);
    $minrpm = max($rpm, 500);  // 500 is about as low as an engine should get
    $percent = makePercent($minrpm, 500, 6000);
    $barsize = makeBar($percent, 350);
    $color = makeColor($percent);
    array_push($table, array("mph"=> $i, "rpm"=> $rpm, "minrpm"=>$minrpm, "barsize"=> $barsize, "color"=>$color));
  }
  return $table;
}

function makePercent($num, $low, $high){
  $num -= $low;
  if($num/$high > 1){
    return 1;
  }
  return round($num/$high, 2);
}

function makeBar($percent, $max){
  return round($max * $percent, 0);
}

function makeColor($percent){
  // mix between red and blue where blue = 0 and red = 1
  $red = round(255 * $percent, 0);
  $blue = 255 - $red;
  return sprintf("%02X%02X%02X", $red, 0, $blue);
}

The HTML input form (the user-interface portion of the calculator) below used my Darts template engine, but could easily be converted to straight PHP or HTML (without remembering the previous settings).

<form action="[selfnameonly]#scroll-to-results" method="post">
<ol>
  <li>
    <input type="hidden" name="go" value="y">
    <label for="trans">Transmission</label>
    <select name="trans" id="trans">
      <option [formoption trans is 'th350']  >TH 350</option>
      <option [formoption trans is 'th400']  >TH 400</option>
      <option [formoption trans is 'th700r4']>TH 700R4</option>
      <option [formoption trans is '4l80e']  >4L80-E</option>
      <option [formoption trans is 'al1000'] >Allison 1000</option>
      <option [formoption trans is 'c4']     >C-4</option>
      <option [formoption trans is 'c5']     >C-5</option>
      <option [formoption trans is 'c6']     >C-6</option>
      <option [formoption trans is 'aod']    >Ford AOD</option>
      <option [formoption trans is 'tf727']  >TorqueFlite 727</option>
      <option [formoption trans is 'amcsr4'] >AMC SR4</option>
      <option [formoption trans is 'sm420']  >SM 420</option>
      <option [formoption trans is 'sm465']  >SM 465</option>
      <option [formoption trans is 't176']   >T-176</option>
      <option [formoption trans is 't177']   >T-177</option>
      <option [formoption trans is 't178']   >T-178</option>
      <option [formoption trans is 'nv3500'] >NV3500</option>
      <option [formoption trans is 'nv4500'] >NV4500</option>
      <option [formoption trans is 'zfs6650']>ZF S6-650</option>
      <option [formoption trans is 'amcsr4'] >AMC SR4</option>
    </select>
  </li>
  <li>
    <label for="tcase">Transfer Case</label>
    <select name="tcase" id="tcase">
      <option [formoption tcase is 'none']   >None</option>
      <option [formoption tcase is 'dana300']>Dana 300</option>
      <option [formoption tcase is 'bw1356'] >Borg Warner 1356</option>
      <option [formoption tcase is 'dspicer18']>Dana Spicer 18</option>
      <option [formoption tcase is 'dspicer20']>Dana Spicer 20</option>
      <option [formoption tcase is 'np203']  >NP 203</option>
      <option [formoption tcase is 'np205']  >NP 205</option>
      <option [formoption tcase is 'np207']  >NP 207</option>
      <option [formoption tcase is 'np208']  >NP 208</option>
      <option [formoption tcase is 'np231']  >NP 231</option>
    </select>
  </li>
  <li>
    <label for="diff">Differential Ratio (default: 1:3.7)</label>
    <input type="text" name="diff" id="diff" value="[diff]" size="4" maxlength="5">
  </li>
  <li>
    <label for="crawler">Crawl/Crawler Box Ratio (default: 1:1, meaning no crawl box)</label>
    <input type="text" name="crawler" id="crawler" value="[crawler]" size="3" maxlength="3">
  </li>
  <li>
    <label for="tire">Tire Height (<a href="http://www.dakota-truck.net/TIRECALC/tirecalc.html">find yours</a>) (inches)</label>
    <input type="text" name="tire" id="tire" value="[tire]" size="3" maxlength="3">
  </li>
  <li>
    <input type="submit" value="Calculate">
  </li>
</ol>
</form>

And finally, here’s how the results were displayed. You can see that the Darts template engine was being used again, but conversion to straight PHP is not a problem.

[ifset results]
  <a name="scroll-to-results"></a>
  <h2>Results</h2>

  <table>
    <tr><td colspan="2">
      <h3>Crawling</h3>
      <p>This is a slow offroading scenario.
      Here we have the transmission in low gear (1:[transLo]),
      the transfer case (if any) in low (1:[tcaseLo]),
      and the crawl box (if any) engaged (1:[crawler]).
      The total gear ratio is <strong>1:[crawl_ratio]</strong>.</p>
    </td></tr>
    <tr><th>MPH</th><th>RPM</th></tr>
    [loop crawl_table as t]
      <tr>
        <td>[t.mph]</td>
        <td style="width: 400px;">
          <div style="float: left; margin-right: 10px;">[t.rpm]</div>
          <div style="float: left; width: [t.barsize]px; background-color: #[t.color]">&nbsp;</div>
        </td>
      </tr>
    [end]

    <tr><td colspan="2">
      <h3>Launching</h3>
      <p>This is normal street driving starting from a standstill.
      Here we have the transmission in low gear (1:[transLo]),
      the transfer case (if any) in high (1:[tcaseHi]),
      and the crawl box (if any) disengaged.
      The total gear ratio is <strong>1:[launch_ratio]</strong>.</p>
    </td></tr>
    <tr><th>MPH</th><th>RPM</th></tr>
    [loop launch_table as t]
      <tr>
        <td>[t.mph]</td>
        <td>
          <div style="float: left; margin-right: 10px;">[t.rpm]</div>
          <div style="float: left; width: [t.barsize]px; background-color: #[t.color]">&nbsp;</div>
        </td>
      </tr>
    [end]

    <tr><td colspan="2">
      <h3>Flat Out</h3>
      <p>Assuming you can legally do so, here is your vehicle at high speeds.
      Here we have the transmission in top gear (1:[transHi]),
      the transfer case (if any) in high (1:[tcaseHi]),
      and the crawl box (if any) disengaged.
      The total gear ratio is <strong>1:[highway_ratio]</strong>.</p>
    </td></tr>
    <tr><th>MPH</th><th>RPM</th></tr>
    [loop highway_table as t]
      <tr>
        <td>[t.mph]</td>
        <td>
          <div style="float: left; margin-right: 10px;">[t.rpm]</div>
          <div style="float: left; width: [t.barsize]px; background-color: #[t.color]">&nbsp;</div>
        </td>
      </tr>
    [end]
  </table>

  <p>Note: Not all transmissions or transfer cases with the same designation or part number will have the same gear ratios. Tires are not usually the exact height listed.</p>
[end]

If you’ve read this far, thanks for the trip down programming memory lane.

Beep boop.