Hyperbolic Tangent Calculator (tanh)

tanh(x) = sinh(x) / cosh(x). Bounded between −1 and 1. Used in neural networks.

Inputs

Result

Loading calculator…

How to use this calculator

  • Enter x.
  • Read tanh(x) + companion sinh, cosh.

About this calculator

Hyperbolic tangent: tanh(x) = sinh(x)/cosh(x) = (eˣ − e⁻ˣ)/(eˣ + e⁻ˣ). Bounded in (−1, 1) — this is why early neural networks used tanh as an activation function (sigmoidal but symmetric around 0). Modern nets prefer ReLU for speed, but tanh remains useful in RNN gates. Also appears in special relativity (rapidity), heat transfer, and signal processing.

Frequently asked

Why is tanh used in ML?+
Smooth, bounded, zero-centered (unlike sigmoid which is [0,1]). Better-conditioned gradients in deep nets — but ReLU has largely replaced it.
Saturation?+
For |x| > 3, tanh ≈ ±1. Gradients vanish — hard for deep networks to learn through. Why ReLU is preferred.
Connection to logistic sigmoid?+
tanh(x) = 2σ(2x) − 1, where σ is the logistic sigmoid. Just a scaled and shifted version.
Rapidity in relativity?+
tanh(rapidity) = velocity/c. Adding rapidities is linear, while velocities don't add linearly at high speeds.
Inverse?+
tanh⁻¹(x) = ½ ln((1+x)/(1−x)) for |x| < 1. Also known as arctanh or atanh.

Related calculators

More tools you might like

Hand-picked tools that pair well with this one — same audience, same intent.