DEV Community

Herry Potter
Herry Potter

Posted on

How Mouse DPI, eDPI and cm/360 Work (With JavaScript Examples)

Gamers argue about mouse sensitivity all the time, but the math behind it is simple. This post shows how DPI, eDPI and cm/360 relate, with small JavaScript functions you can reuse.

DPI in one line

DPI (dots per inch) is how many counts a mouse sensor reports for every inch you move it. At 800 DPI, one inch of movement gives 800 counts. The game then turns those counts into crosshair movement, using its own sensitivity setting and a game-specific multiplier called yaw.

eDPI

eDPI multiplies the mouse DPI by the in-game sensitivity. It is useful for comparing two setups in the same game.

function eDPI(dpi, sensitivity) {
  return dpi * sensitivity;
}

console.log(eDPI(800, 0.35)); // 280
Enter fullscreen mode Exit fullscreen mode

It does not work across games, because every game has a different yaw.

cm/360

cm/360 is how far you move the mouse, in centimeters, to turn a full 360 degrees. It works across games because it measures real distance.

function cmPer360(dpi, sensitivity, yaw) {
  const inches = 360 / (dpi * sensitivity * yaw);
  return inches * 2.54;
}

// Valorant: yaw 0.07
console.log(cmPer360(800, 0.35, 0.07).toFixed(1)); // 46.7
Enter fullscreen mode Exit fullscreen mode

Converting sensitivity between games

To keep the same cm/360 with the same DPI, scale the sensitivity by the ratio of the two yaw values.

function convertSensitivity(sens, fromYaw, toYaw) {
  return sens * (fromYaw / toYaw);
}

// Valorant (0.07) to CS2 (0.022)
console.log(convertSensitivity(0.35, 0.07, 0.022).toFixed(3)); // 1.114
Enter fullscreen mode Exit fullscreen mode

Check it: cmPer360(800, 1.114, 0.022) also gives about 46.7 cm.

Things to keep in mind

  • Use each game's real yaw value. Valorant uses 0.07 and CS2 uses 0.022.
  • Turn off mouse acceleration, or the math won't match what you feel.
  • Rounding in the game's sensitivity box makes the match slightly off.

I also have a small project that checks mouse DPI (disclosure: it's mine): DPI check project

Top comments (1)

Collapse
 
susanacharya profile image
Susan Acharya •

clean explainer, and the numbers check out. one thing worth adding: the math only holds if windows pointer speed is 6/11 and enhance pointer precision is off, otherwise the OS scales the counts before the game sees them. it'd also be handy to add the inverse (target cm/360 to sensitivity) so people can pick a distance and solve for sens.