Hyperbolic Tangent (tanh) Calculator
This calculator works out the hyperbolic tangent, tanh(x), for any real number x, showing sinh(x) and cosh(x) alongside so you can see how the result is built. Tanh is defined as sinh(x) divided by cosh(x), the same as (e to the x, minus e to the minus x) over (e to the x, plus e to the minus x). It is an odd function with a smooth S shaped curve that always sits strictly between -1 and 1, flattening out towards those limits as x moves away from zero. This bounded shape is why tanh turns up so often outside pure maths: it is a standard activation function in neural networks, and it appears in physics and engineering problems involving exponential growth and decay, wave equations and electrical transmission lines. To use it, type your value of x into the input box; the result updates instantly, showing tanh(x) as the main figure with sinh(x) and cosh(x) underneath for reference. Results are rounded to six decimal places for display, though the calculation uses full precision. There is no limit on the size or sign of x you can enter, since tanh is defined for every real number, but very large values simply return a result extremely close to -1 or 1. A worked example below confirms tanh(1) is about 0.761594, which you can check by entering 1 above.
The formula
The hyperbolic tangent is tanh(x) = sinh(x) / cosh(x) = (e^x - e^-x) / (e^x + e^-x). It is odd and bounded strictly between -1 and 1.
Worked example
tanh(1) = sinh(1) / cosh(1), about 1.175201 / 1.543081 = 0.761594. Enter 1 above to confirm.
Frequently asked questions
What is the formula for tanh?
tanh(x) = sinh(x) / cosh(x), or equivalently (e^x - e^-x) / (e^x + e^-x).
What range does tanh take?
It always lies strictly between -1 and 1, approaching -1 for large negative x and 1 for large positive x.
Why is tanh used in machine learning?
Its smooth, bounded S shape maps any input to a value between -1 and 1, which is useful as a neuron activation function.
Who this calculator is for
This calculator is for students, engineers and machine-learning practitioners working with tanh.
What this calculator assumes
- You enter a real number x.
- tanh is computed from the exponential definition.
- Results are rounded for display.
Formula and sources
Related calculators
- Hyperbolic Sine Calculator: sinh(x).
- Hyperbolic Cosine Calculator: cosh(x).
- Inverse Hyperbolic Sine Calculator: arcsinh(x).