Tanh Calculator: Calculate the Hyperbolic Tangent
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
A tanh calculator finds the hyperbolic tangent of a number you enter, using the same input and output scale as the standard mathematical function tanh(x). Enter a real value for x to get tanh(x), a result between −1 and 1; the calculator can also show the equivalent exponential formula.
Formula
The hyperbolic tangent is defined by tanh(x) = (ex − e−x) / (ex + e−x). An equivalent form is tanh(x) = (e2x − 1) / (e2x + 1). Here, x is the input, a dimensionless real number, and e is the mathematical constant approximately 2.71828. The output is also dimensionless.
The calculator uses the first form for its main result and displays the second form as a check. Neither formula requires an angle unit: tanh is not the ordinary tangent function, and its input is not interpreted as degrees.
Worked Example
With the default input x = 1:
- Calculate e1 ≈ 2.718282 and e−1 ≈ 0.367879.
- Subtract to get the numerator: 2.718282 − 0.367879 = 2.350403.
- Add to get the denominator: 2.718282 + 0.367879 = 3.086161.
- Divide: 2.350403 ÷ 3.086161 ≈ 0.761594.
Rounded to six decimal places, tanh(1) is 0.761594. The equivalent expression gives the same result: (e2 − 1) / (e2 + 1) ≈ 0.761594.
What the Hyperbolic Tangent Means
The function tanh is a hyperbolic function, related to the exponential function and to the geometry of a hyperbola. Its name resembles “tangent,” but it is distinct from the circular trigonometric tangent. The ordinary tangent is defined using angles and can become unbounded near certain angles; tanh accepts any real input and always remains strictly between −1 and 1.
Its graph passes through (0, 0), rises smoothly, and approaches 1 as x increases and −1 as x decreases. It does not reach either boundary for any finite real input. It is also an odd function: tanh(−x) = −tanh(x). For example, tanh(−1) is approximately −0.761594.
Near zero, tanh(x) is approximately x. More precisely, its small-input expansion begins tanh(x) = x − x3/3 + … . That makes the function nearly linear for small values, while its slope gradually decreases as the magnitude of x grows.
When to Use a Tanh Calculator
A calculator is useful when you need a numerical value rather than a symbolic expression. Tanh occurs in mathematics, physics, engineering, and computing. It is also used as a nonlinear activation function in some neural-network designs: it maps a real-valued input to a bounded output and preserves the sign of that input.
- Evaluate a function: Find tanh(0.5), tanh(2), or another real input to a chosen precision.
- Check a derivation: Compare a direct tanh calculation with the exponential definition.
- Work with a model: Calculate a bounded transformation when a formula specifies tanh.
- Inspect limiting behavior: See how positive and negative inputs produce values close to 1 and −1.
The output is a pure number, not a percentage or a measurement with units. If a larger equation requires tanh(x), use the calculator result at the precision appropriate to that equation; keep extra digits during intermediate steps when possible.
Reading Results and Avoiding Common Mistakes
The sign of the result matches the sign of the input, and the result’s magnitude is less than 1. A value such as 0.964028 does not mean 0.964028 degrees. It is simply the function value. If you need a percentage representation, you may multiply the result by 100, but that is a separate presentation choice and does not change the tanh value.
- Do not confuse tanh with tan. The “h” identifies the hyperbolic tangent. A calculator’s tan key typically means the circular tangent, not tanh.
- Check parentheses. In the exponential form, the denominator is ex + e−x; the whole numerator is divided by the whole denominator.
- Keep the input scale consistent. Tanh has no built-in unit conversion. If x comes from a formula, use that formula’s intended numerical value.
- Understand rounding and saturation. Large positive or negative inputs can produce displayed values that round to 1 or −1. Mathematically, finite inputs do not give exactly those limits.
Inverse and Related Functions
The inverse hyperbolic tangent, written atanh(y) or tanh−1(y), answers a different question: which input has hyperbolic tangent y? For real-valued results, its domain is −1 < y < 1, and its formula is atanh(y) = ½ ln((1 + y)/(1 − y)). It is undefined as a finite real number at y = −1 or y = 1, and values outside that interval do not have real inverse outputs.
Do not read tanh−1 as 1/tanh. Inverse-function notation means atanh, while the reciprocal of tanh(x) is called the hyperbolic cotangent, coth(x), wherever tanh(x) is nonzero. The other hyperbolic functions include sinh and cosh, with tanh(x) = sinh(x)/cosh(x).
Frequently Asked Questions
What is tanh(0)?
tanh(0) = 0. In the exponential definition, the numerator is 1 − 1 = 0 and the denominator is 1 + 1 = 2.
Can tanh be greater than 1?
No, not for a finite real input. Its value is strictly between −1 and 1, although rounded displays for large inputs may show 1 or −1.
Is tanh the same as tan?
No. Tan is the circular tangent, usually applied to an angle; tanh is the hyperbolic tangent, defined using exponentials and bounded between −1 and 1.
Does tanh use degrees or radians?
Neither. Tanh takes a real number, not an angle, so degree-versus-radian mode does not apply.
How do I calculate the inverse of tanh?
For −1 < y < 1, use atanh(y) = ½ ln((1 + y)/(1 − y)). This returns the input whose tanh is y.
Related
Formula used
in x | Input x | - | 1 | out tanh | Hyperbolic tangent | - | (exp(x) - exp(-x)) / (exp(x) + exp(-x)) | 6 out eform | Equivalent expression | - | (exp(2 * x) - 1) / (exp(2 * x) + 1) | 6
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.