How to Calculate Straight-Line Distances

This guide walks you through every feature of the Straight Line Distance Calculator, from entering your first address pair to exporting a full batch of results.

Input Formats

The tool accepts origin-destination pairs separated by a tab, comma, or pipe character. Enter one pair per line.

Tab-Separated (recommended — paste from Excel/Sheets)

New York, NY	Los Angeles, CA
Chicago, IL Houston, TX
Miami, FL Atlanta, GA

Pipe-Separated

New York, NY | Los Angeles, CA
Chicago, IL | Houston, TX

Pasting from Spreadsheets

If you copy two columns from Excel or Google Sheets, they paste as tab-separated values — which is the default delimiter. Just paste directly into the input box.

Supported Location Types

You can enter any location that Google Maps can recognize:

  • Full addresses: 123 Main St, Springfield, IL 62701
  • City and state: Denver, CO
  • ZIP codes: 90210
  • City only: Seattle (less precise — uses city center)
  • Landmarks: Statue of Liberty
  • International: 10 Downing Street, London, UK

Address Precision

The more specific your location, the more accurate your distance. A full street address gives coordinates to within a few meters, while a ZIP code gives the geographic center of that ZIP area.

Entering Pairs Manually

1

Open the Tool

2

Type or Paste Your Pairs

Enter origin-destination pairs in the text area. Use the format: Origin [tab/comma/pipe] Destination, one pair per line. The line counter on the left shows how many pairs you've entered.
3

Select Your Unit

Choose Miles or Kilometers from the unit dropdown. You can change this and recalculate at any time.
4

Click Calculate Distances

The tool processes each pair. A progress bar shows the current status. Results appear in the table below.

Importing from a File

For larger batches, import a CSV or Excel file:

1

Click "Import CSV / Excel"

The file import panel opens with drag-and-drop support.
2

Upload Your File

Drag a file onto the upload area, or click to browse. Supported formats: .csv, .xlsx, .xls.
3

Column Mapping

The tool automatically detects your columns. It expects two columns: one for origins and one for destinations. If your file has headers, the tool detects and skips the header row.
4

Review and Calculate

The imported data appears in the input box. Review it, adjust if needed, and click Calculate Distances.

Delimiter Auto-Detection

The tool automatically detects whether your data uses tabs, commas, or pipes as delimiters. For addresses containing commas (like "New York, NY"), use tab or pipe separation to avoid ambiguity. The tool has smart comma handling that distinguishes address commas from delimiter commas, but tab separation is the most reliable.

Understanding the Results

After calculation, results appear in a table with these columns:

ColumnDescription
**#**Row number matching your input order
**Origin**The geocoded, standardized origin address
**Destination**The geocoded, standardized destination address
**Distance**Straight-line distance in your selected unit (miles or km)
**Status**OK (success) or ERROR (with explanation)

Result Summary

Above the results table, a summary card shows:

  • Total pairs processed
  • Successful calculations
  • Failed calculations
  • Processing time in milliseconds

Handling Errors

If a calculation fails, the Status column shows "ERROR" with a reason. Common causes:

  • "Origin: No results found" — The origin address could not be geocoded. Check spelling or add more detail.
  • "Destination: No results found" — Same issue for the destination.
  • "Origin and destination are both required" — One or both fields were empty.

Partial Results

If some pairs fail while others succeed, you still get results for the successful ones. Failed rows appear in the results table with their error messages, so you can identify and correct them.

Switching Units

You can switch between miles and kilometers at any time using the unit dropdown. To recalculate with a different unit:

  1. Change the unit selector
  2. Click Calculate Distances again
  3. The tool re-runs the batch with the new unit

The haversine formula converts distances based on Earth's radius: 3,958.8 miles or 6,371.0 kilometers.

Sample Data

Click the Load Sample Data button to populate the input with example address pairs. This is useful for:

  • Seeing the expected format before entering your own data
  • Testing the tool with known locations
  • Verifying your API key is working correctly

Tips for Best Results

  1. Be specific — Full addresses give more accurate coordinates than ZIP codes or city names.
  2. Use tab separation — Especially if your addresses contain commas.
  3. Batch similar requests — The tool deduplicates geocoding, so reusing the same origin across many pairs saves time.
  4. Check failed rows — Review errors and re-submit corrected pairs rather than the entire batch.
  5. Choose the right unit — Select miles or kilometers before calculating to avoid re-running.

Was this article helpful?