Function of the Manhattan Distance Calculator is to help you get a better idea of how far Manhattan is. Using this calculator you’ll learn the Manhattan distance, what it’s useful for, a lot of new terms and how to calculate the Manhattan distance between two of your own locations. Learning has never been easier. Do you want to know how long you have to walk to go to school? Maybe you’re plotting your morning jogging route? Or have you had enough of plain old Euclidean geometry?

Here you have all above explained with example of how to use our calculator. We will share with you more calculators to make it easier for you. Using math calculators like Golden Rectangle, Decimal, or Perimeter Calculator will make it easier for you to use and understand this matter. Don’t miss our algorithms for changing the base of logarithms as well.

What is Manhattan Distance?

The Manhattan distance is a measure for measuring the distance between two places. It’s the total of the absolute differences in the coordinates of these two places. Other names for it include:

  • The distance between taxicabs;
  • The distance between city blocks; and
  • The snake’s range.

Consider the following scenario: you’re in a metropolis like New York or San Francisco, where the streets are neatly organized into a grid, and where are a million of people. You can’t travel diagonally through the city blocks, therefore you have to go from intersection to intersection in the grid to get from point A to point B. In mathematical words, you’re limited to moving along the city’s coordinates axes instead of a bird, which may fly directly there.

The Manhattan distance is the number of city blocks you’d have to travel, and you can probably guess where its other titles – taxicab distance, city block distance, and snake distance – originate from.

According to the Pythagorean theorem:


While this is correct, the Euclidean distance is obtained. If we rewrite the Pythagorean theorem for the Manhattan distance, we will have the sum of a and b:


Manhattan Distance Formula

There are two N-dimensional locations in this problem

\overrightarrow {a}=[a_1,...a_N]



so the Manhattan distance is the next algorithms sum:


Manhattan Distance vs. Euclidean Distance

While Euclidean distance determines the shortest or shortest distance between two places, Manhattan has its own set of rules. If we were to utilize a Chess dataset, this distance would be preferable to Euclidean distance.

The shortest path between source and destination is a straight line, but Manhattan distance is the total of all real distances between the source (s) and destination (d), and each distance is always straight lines, as shown in Figure.

Manhattan vs Euclidean Distance
Euclidean distance – blue line; Manhattan distance – red and green line

As the dimension of the data grows, the used Manhattan distance metric is better than the Euclidean distance metric. The ‘curse of dimensionality,’ as it is termed, causes this.

Manhattan Distance Calculator – How to Use?

Using the Calculator is very simple. Learning has never been more interesting. No more search for answer in math books. It initially asks how many dimensions your points have, allowing up to four-dimensional space. Simply, your function is to insert your two positions into the calculator, and it will calculate the Manhattan distance between them. So:

  • select how many dimensions your points have;
  • enter that using points bellow;
  • and the calculator will calculate values for you.

Manhattan Distance Calculator – Example

So, as we said, the use of the calculator is simple, let’s go step by step through the example, to calculate it:

  • select how many dimensions your points have (we will take 2D);
  • enter data values (first point x = 5 and y = 9; second point x = 7 and y = 8);
  • and below calculator will calculate result of distance = 3.

Why Is The Manhattan Distance Important

The Manhattan distance, also known as the Taxicab distance or the City Block distance, is a measure of how much is the separation of two vectors with real values used.

Vectors that describe items on a regular grid, such as a chessboard or city blocks, may find it more helpful. The measure’s name, taxicab, alludes to the idea behind what it calculates: the shortest path a taxicab would travel between city blocks (coordinates on the grid).

For two vectors in an integer feature space, calculating Manhattan distance rather than Euclidean distance could make sense. Taxicab distance is used in data science and machine learning, and works well with python scripting also. Machine learning is a very interesting area, and we recommend you to learn more about it.


How is Manhattan distance calculated?


What is the difference between Euclidean distance and Manhattan distance?

While Euclidean distance determines the shortest or shortest distance between two places, Manhattan has its own set of rules.

Why is it called the Manhattan distance?

The Manhattan distance gets its name from the grid structure that represents most of the streets on Manhattan’s island and the routes that provide the shortest route between two sites. We call this distance sometimes Taxicab distance or the City Block distance as a result of this.

Is Manhattan distance accurate?

It works best when the points are placed in a grid, and the problem we’re working on prioritizes the distance between the points solely, together with the grids, rather than the geometric distance.