JavaScript Math.atanh() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Math

Definition

Math.atanh(x) returns the inverse hyperbolic tangent of a number. It is the reverse of Math.tanh(). The input must be between -1 and 1.

Math is built into JavaScript. Call the method directly. It is not a constructor, so never write new Math().

Syntax

Call Math.atanh() like this. Start with this line.

JavaScript
Math.atanh(x)
CallWhat it does
Math.atanh(x)Returns the inverse hyperbolic tangent of x.

Built into JavaScript. Call Math.atanh() on the Math object — no import required.

Library declarations
JavaScript
Math.atanh(x)
JavaScript
interface Math {
  atanh(x: number): number;
}

Parameters

ParameterDescription
xRequired. A number between -1 and 1. Numbers outside -1 to 1 return NaN.

Return Value

Return ValueDescription
numberThe inverse hyperbolic tangent of x. Returns Infinity for 1, -Infinity for -1, and NaN outside -1 to 1.

JavaScript Examples

Example 1 — Basic Use

Pass a number between -1 and 1.

JavaScript
console.log(Math.atanh(0));     // 0
console.log(Math.atanh(0.5));   // 0.5493061443340548
console.log(Math.atanh(-0.5));  // -0.5493061443340548
console.log(Math.atanh(0.99));  // 2.6466524123622457
Try It Yourself

How It Works

  1. Zero. Math.atanh(0) is 0.
  2. Positive and negative. 0.5 and -0.5 give the same number with opposite signs.
  3. Near the edge. As x gets close to 1, the result grows fast.

Example 2 — Check With the Log Formula

Compare Math.atanh() with the math formula.

JavaScript
function atanhFormula(x) {
  return 0.5 * Math.log((1 + x) / (1 - x));
}

console.log(Math.atanh(0.5).toFixed(6));   // 0.549306
console.log(atanhFormula(0.5).toFixed(6)); // 0.549306
console.log(Math.atanh(Math.tanh(0.5)).toFixed(6)); // 0.500000
Try It Yourself

How It Works

  1. Formula. The inverse hyperbolic tangent is 0.5 * ln((1 + x) / (1 - x)).
  2. Same value. Both lines print the same number.
  3. Undo tanh. Math.atanh(Math.tanh(0.5)) returns 0.5 again.

Example 3 — Edges: 1, -1 and Out of Range

Look at what happens at the limits and outside them.

JavaScript
console.log(Math.atanh(1));    // Infinity
console.log(Math.atanh(-1));   // -Infinity
console.log(Math.atanh(2));    // NaN
console.log(Number.isFinite(Math.atanh(0.5)));  // true
console.log(Number.isFinite(Math.atanh(1)));    // false
Try It Yourself

How It Works

  1. At 1. The curve goes to infinity, so you get Infinity.
  2. At -1. You get -Infinity.
  3. Past the limit. 2 is not valid, so the result is NaN.
  4. Safe check. Number.isFinite() tells you if the result is a usable number.

Browser & Runtime Support

Math.atanh() is part of ES2015 and is Baseline Widely available in modern browsers and Node.js.

✓ Baseline · ES2015

Math.atanh()

Supported in Chrome, Firefox, Safari, Edge, and Node.js for years. Safe for modern apps without a polyfill.

98% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Math.atanh Excellent

Bottom line: Use Math.atanh() in new code. Only very old browsers, like Internet Explorer, lack it.

Frequently Asked Questions

Math.atanh(x) returns the inverse hyperbolic tangent of x. It reverses Math.tanh(). Math.atanh(0) is 0.
Numbers from -1 to 1. Math.atanh(1) is Infinity, Math.atanh(-1) is -Infinity, and Math.atanh(2) is NaN.
Math.atanh(x) equals 0.5 * Math.log((1 + x) / (1 - x)).
No. Math.atan() is the inverse of the normal tangent. Math.atanh() is the inverse of the hyperbolic tangent and has a smaller input range.
It was added in ES2015 and works in all modern browsers and Node.js.

Next: cbrt()

Learn how to find the cube root of a number.

cbrt() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful