Fick's Second Law Calculator

Solve Fick's second law for a semi-infinite solid: concentration at depth x after time t, required time, case depth or diffusion coefficient. Used for carburizing, doping and diffusion problems.

Last updated 28 November 2026

Same units as Cₛ and C₀ (wt%, mol/L, atoms/cm³…)
ResultEnter values to calculate
    Show calculation steps

    What is Fick's second law?

    Fick's Second Law of Diffusion: The rate of change of concentration at a point equals the diffusion coefficient times the curvature of the concentration profile. — Adolf Fick, 1855

    Fick's first law tells you how fast matter flows once a concentration profile has settled. In many real problems, though, the profile has not settled. Carbon soaking into a steel gear, a dopant entering a silicon wafer and salt working its way into a ham all change from minute to minute. Fick's second law describes this changing, or non-steady-state, diffusion. It predicts the concentration at any depth and any time.

    The law comes from combining the first law with conservation of mass. Picture a thin slice of material. If more atoms diffuse into the slice than out of it, the concentration in the slice rises. If more leave than arrive, it falls. The flux depends on the slope of the concentration profile, so the change in flux across the slice depends on how that slope changes, which is the curvature of the profile. That gives the second law: the rate of change of concentration equals D times the curvature.

    A useful way to read it: wherever the profile bends upward like a valley, concentration rises and the valley fills in. Wherever it bends downward like a hill, concentration falls and the hill flattens. Diffusion always smooths sharp differences out.

    Graph of concentration against depth below a surface held at a constant concentration Cs, at three times t1, 4 t1 and 16 t1. Each curve starts at Cs at the surface and falls to the initial concentration C0 deeper in. Later curves reach further into the material. Quadrupling the time doubles the depth reached. CₛC₀depth x →t₁4t₁16t₁
    Concentration profiles from the erfc solution. Each fourfold increase in time doubles the penetration depth, because depth scales with √(Dt).

    Fick wrote the equation down in the same 1855 paper as his first law, by analogy with Fourier's heat equation. It is mathematically identical to the heat equation, which is why the thermal diffusivity of a material plays exactly the role that D plays here.

    The formula explained

    ∂C∂t = D ∂²C∂x²  ⇒  C(x,t) − C0Cs − C0 = 1 − erf(x2√Dt)
    SymbolQuantitySI unitMeaning
    C(x,t)Concentration at depth x—Concentration at depth x after time t
    CₛSurface concentration—Constant concentration held at the surface
    C₀Initial concentration—Uniform concentration in the solid before diffusion starts
    xDepthmDistance below the surface
    DDiffusion coefficientm²/sDiffusion coefficient at the process temperature
    tTimesDiffusion time

    The differential equation. ∂C/∂t is how fast the concentration at a fixed depth is changing, in (concentration unit)/s. ∂²C/∂x² is the curvature of the profile, in (concentration unit)/m². Multiplying the curvature by D (m²/s) gives (concentration unit)/s, so both sides match.

    The solution used by this calculator. The equation has many solutions, one for each set of starting and boundary conditions. This calculator uses the most common one, for a semi-infinite solid:

    • before diffusion starts, the solid has a uniform concentration C₀;
    • from time zero, the surface is held at a constant concentration Cₛ;
    • the solid is thick enough that its far side never notices the diffusion;
    • D does not depend on concentration or position.

    Under those conditions the profile is C(x,t) = C₀ + (Cₛ − C₀) erfc(z), where z = x / (2√(Dt)). The error function erf and its complement erfc = 1 − erf are standard functions built into spreadsheets and scientific software. erfc(0) = 1 at the surface, and erfc falls to almost zero by z = 2.

    Concentration units. Because only ratios of concentration differences appear, C, Cₛ and C₀ can be in any unit: wt%, at%, mol/L or atoms/cm³. All three must use the same unit, and the answer comes back in it.

    A different source. If a fixed amount of material is deposited on the surface and then spread inward, as in the "drive-in" step of semiconductor doping, the surface concentration is not constant. The solution is then a Gaussian, C = (M/√(πDt)) exp(−x²/4Dt), where M is the amount per unit area. This calculator does not cover that case.

    How to use this calculator

    1. Choose the quantity you want to find in the Calculate menu. It is highlighted as the result field.
    2. Enter the known values. Scientific notation such as 1.6e-11 is accepted.
    3. Select a unit for each value. Units are converted to SI automatically.
    4. The answer updates as you type. Open Show calculation steps to see the working, or use Copy result to share a link with your inputs.

    Step-by-step worked example

    Problem. A steel gear containing 0.20 wt% carbon is gas-carburized. The furnace atmosphere holds the surface at 1.20 wt% carbon. At the process temperature, carbon in the steel has D = 1.6 × 10⁻¹¹ m²/s. (a) What is the carbon content 0.5 mm below the surface after 10 hours? (b) At what depth is the carbon content 0.60 wt% after the same 10 hours?

    Part (a)

    1. Convert units. t = 10 h = 36 000 s and x = 0.5 mm = 5.0 × 10⁻⁴ m.
    2. Find the diffusion distance. √(Dt) = √(1.6 × 10⁻¹¹ × 36 000) = √(5.76 × 10⁻⁷) = 7.59 × 10⁻⁴ m.
    3. Find z. z = x / (2√(Dt)) = 5.0 × 10⁻⁴ / (2 × 7.59 × 10⁻⁴) = 0.329.
    4. Evaluate erfc. erfc(0.329) ≈ 0.641.
    5. Find C. C = 0.20 + (1.20 − 0.20) × 0.641 = 0.84 wt% C.

    Part (b)

    1. Find the required erfc value. (C − C₀)/(Cₛ − C₀) = (0.60 − 0.20)/(1.20 − 0.20) = 0.40, so erfc(z) = 0.40 and erf(z) = 0.60.
    2. Invert. erf(z) = 0.60 gives z ≈ 0.595.
    3. Find the depth. x = 2z√(Dt) = 2 × 0.595 × 7.59 × 10⁻⁴ = 9.0 × 10⁻⁴ m ≈ 0.90 mm.

    Try it: the calculator's defaults reproduce part (a). For part (b), choose "Depth (x)" in the Calculate menu and enter C = 0.6.

    How to interpret the result

    • Read the result as a fraction of the way from C₀ to Cₛ. The ratio (C − C₀)/(Cₛ − C₀) runs from 1 at the surface to 0 deep inside. In the example, 0.641 means the point 0.5 mm down has gained 64% of the carbon it could possibly gain.
    • Use √(Dt) as your ruler. At a depth equal to √(Dt), z = 0.5 and erfc(0.5) ≈ 0.48, so the concentration is about halfway between C₀ and Cₛ. At 4√(Dt), z = 2 and the change is below 0.5%. For practical purposes the diffusion has not reached that far.
    • Depth grows with the square root of time. To push the same concentration twice as deep, you need four times as long. This is why deep case hardening is slow and expensive. Raising the temperature, which raises D sharply, is usually the better lever.
    • Check the semi-infinite assumption. The result is reliable only if the part is much thicker than the diffusion zone. A good rule is thickness greater than about 4√(Dt), measured from each surface that is exposed. In the example that is 4 × 0.76 mm ≈ 3 mm, so a gear tooth only a few millimetres thick would need a more detailed model.
    • "No physical solution" means the target concentration is not between C₀ and Cₛ. The profile can never reach a value outside that range.

    Real-world applications

    • Case hardening steel. Gears, camshafts and bearings are carburized or nitrided to make a hard, wear-resistant surface over a tough core. Heat-treatment engineers use the erfc solution to choose the time and temperature that give a specified case depth.
    • Doping semiconductors. In the "predeposition" step, a silicon wafer is exposed to a dopant source that holds the surface concentration constant. This gives exactly the erfc profile. The "drive-in" step that follows uses the Gaussian solution. Together they set the junction depth of the device.
    • Corrosion of reinforced concrete. Chloride ions from sea water or road salt diffuse into concrete and eventually attack the steel reinforcement. Service-life models fit measured chloride profiles with this same erfc solution to estimate how many years remain before corrosion starts.
    • Food processing. Salt and sugar penetration during brining, curing and candying follow Fick's second law, as does moisture loss during drying. The square-root-of-time rule explains why thick cuts need much longer curing times.
    • Heating and cooling. Replace D with thermal diffusivity and concentration with temperature, and the same solution tells you how a sudden change in surface temperature penetrates a solid. Examples are a cold snap reaching buried pipes or a steak heating through on a grill.

    Common mistakes and unit-conversion tips

    1. Forgetting the 2 in z = x / (2√(Dt)). Dropping it halves z and gives a concentration that is far too high.
    2. Mixing erf and erfc. The concentration gained follows erfc. If your answer says the surface has the lowest concentration, you have used erf where erfc belongs.
    3. Time in hours, D in m²/s. D and t must share the same time unit. Ten hours is 36 000 s, not 10. The calculator converts this for you.
    4. D for the wrong temperature. In solids, D can change by a factor of 3 or more over 100 °C. Calculate it at your process temperature with the Arrhenius diffusion calculator.
    5. Using wt% for one concentration and at% for another. All three concentrations must be in the same unit.
    6. Applying the solution to a thin part. Once the diffusion zones from opposite faces overlap, the semi-infinite solution no longer applies.
    7. Assuming D is constant when it is not. Carbon in austenite diffuses faster at higher carbon content, so real profiles differ slightly from the ideal erfc curve. For coursework the constant-D model is standard; for production, use measured data or simulation.

    Frequently asked questions

    What is the difference between Fick's first and second law?

    The first law, J = −D dC/dx, gives the flux when the concentration profile is not changing with time (steady state). The second law, ∂C/∂t = D ∂²C/∂x², gives how the profile itself changes with time (non-steady state). The second law is the first law combined with conservation of mass.

    What is the error function (erf)?

    erf(z) = (2/√π)∫₀ᶻ e^(−u²) du. It rises from 0 at z = 0 toward 1 as z grows, and erfc(z) = 1 − erf(z). It appears because the solution of the diffusion equation is built from Gaussian functions. Useful values: erf(0.5) ≈ 0.52, erf(1) ≈ 0.84, erf(2) ≈ 0.995.

    How do I find the time needed to reach a certain case depth?

    Choose "Time (t)" in the Calculate menu, then enter the target concentration C, Cₛ, C₀, the depth x and D. The calculator finds z from erfc(z) = (C − C₀)/(Cₛ − C₀) and returns t = (x / 2z)² / D.

    Why does the calculator say there is no physical solution?

    C must lie strictly between C₀ and Cₛ, because the profile approaches Cₛ only at the surface and C₀ only at infinite depth. Values outside that range have no solution.

    What if the diffusion coefficient depends on temperature?

    It nearly always does. Use the Arrhenius diffusion calculator to get D at your process temperature from D₀ and the activation energy Q, then enter that D here.

    Sources and further reading

    1. Fick, A. (1855). Ueber Diffusion. Annalen der Physik, 170(1), 59–86.
    2. Crank, J. (1975). The Mathematics of Diffusion (2nd ed.). Oxford University Press. Chapters 2–3 cover semi-infinite media and the error-function solution.
    3. Shewmon, P. (1989). Diffusion in Solids (2nd ed.). The Minerals, Metals & Materials Society.
    4. Callister, W. D., & Rethwisch, D. G. (2018). Materials Science and Engineering: An Introduction (10th ed.). Wiley. Chapter 5, Diffusion.
    5. Sze, S. M., & Lee, M. K. (2012). Semiconductor Devices: Physics and Technology (3rd ed.). Wiley. Chapter on impurity doping.