Skip to content
ihateDesmos

Integral of ln x

Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The integral of ln x
∫
ln(x)
dx =
xln(x)−x+C

The integral of ln x is x ln x − x + C. It is the classic use of integration by parts, where the second factor is simply 1.

12342
Open in calculator
y=ln(x)
in blue and its integral
y=xln(x)−x
(with C = 0) in red. Defined for x > 0.

How to integrate ln x

Method: integration by parts.

  1. 1
    Write the integrand as ln x · 1, and choose u = ln x and dv = dx.
  2. 2
    Then du = (1/x) dx and v = x.
  3. 3
    Integration by parts says ∫u dv = uv − ∫v du.
  4. 4
    So ∫ln x dx = x ln x − ∫x · (1/x) dx = x ln x − ∫1 dx.
  5. 5
    This gives x ln x − x + C.
  6. 6
    Check: the derivative of x ln x − x is ln x + 1 − 1 = ln x.

What it means

ln x is negative between 0 and 1 and positive after that, so the integral falls until x = 1 and rises afterwards. Its minimum, at x = 1, is exactly where ln x crosses the axis.

The integral from 1 to e

Using the antiderivative: F(e) − F(1) = 1, which is about 1. A direct numerical integration of ln x gives 1, which agrees.

0.511.522.533.544.55−2−11234

Check by differentiating

The derivative of the answer should give back the original function. The last column measures that slope directly from the answer, and it matches.

Checking the integral
xln xSlope of the answer
1/2−ln 2−ln 2
10−0
2ln 2ln 2
e11
42ln 22ln 2

Common mistakes

  • Writing 1/x, which is the derivative of ln x, not its integral.
  • Forgetting the −x term, which comes from the second integral.
  • Forgetting the + C.

Frequently asked questions

What is the integral of ln x?
The integral of ln x is x ln x − x + C, for x > 0.
What is the integral of ln x from 1 to e?
1, which is about 1.
Why does integrating ln x need integration by parts?
There is no simple rule for integrating a logarithm directly. But its derivative, 1/x, is easy, so parts swaps the logarithm for something that cancels with x.
What is the integral of ln x from 0 to 1?
−1. The function goes to −∞ at 0, but the area stays finite. It is an improper integral that converges.
What is the integral of (ln x)²?
x(ln x)² − 2x ln x + 2x + C, using integration by parts twice.

Keep going

Integrate any function

Type your own function into the integral calculator for the steps, the answer and a graph.

Open the integral calculator