A spike travelling through a neuron, from the cable equation
Touch a branch of a neuron and watch the electrical signal spread, fade or fire, and run down the axon. The cable equation with Hodgkin and Huxley's channels, solved live in the browser.
- Published
- 16 November 2026
- Run
- In the browser
- Model
- Cable equation, Hodgkin-Huxley channels
- Stack
- Rust, webassembly, webgl
- Download
- 70 KB
A neuron is a tree. Thousands of inputs land on its branching dendrites, their effects spread towards the cell body, and when the voltage there rises far enough the cell fires a spike that runs down its axon to the next cells. How a signal fares on that journey, whether it fades, adds up with others or sets off a spike of its own on the way, depends on the shape of the tree and the channels in its membrane.
Simulating that is a sixty-year-old craft. NEURON, the standard simulator, has been in use since the 1980s. Jaxley, published in Nature Methods in 2025, does the same calculation in a form that can be differentiated, so that a detailed neuron model can be fitted to recordings the way a neural network is trained. Neither runs in a web page. The app described here, neuron, solves the same equations in the browser, fast enough to watch. Open it, click a branch, and watch the signal travel.
A leaky cable
A dendrite is a thin tube of salty fluid inside a membrane that leaks. Current injected at one point flows along the inside, and some escapes through the wall as it goes. The voltage along such a tube obeys the cable equation, the same one Kelvin worked out for the transatlantic telegraph. Wilfrid Rall applied it to branching dendrites in 1959:
The first term on the right is current flowing along the branch. It grows with the radius a and falls with Ra, the resistance of the fluid inside. The second is current crossing the membrane. Fine branches carry little current along their length and leak it away quickly, so a signal injected at a dendrite tip arrives at the cell body small and smeared out. Set the app’s dendritic sodium channels to zero and click a tip to see it: the voltage trace at the tip jumps, the one at the cell body barely stirs.
Channels that fire
The membrane current comes from ion channels, and Hodgkin and Huxley’s description of them, from the squid giant axon in 1952, is still the template:
Sodium channels open quickly when the voltage rises and let sodium in, which raises the voltage further. Potassium channels open more slowly and pull it back down. The gates m, h and n each open and close at rates that depend on voltage. Past about −55 mV the sodium current runs away, and the membrane fires a spike to about +40 mV and recovers within a few milliseconds. A patch that fires drives current into its neighbours and fires them too, so the spike travels without fading, and afterwards the patch cannot fire again for a few milliseconds.
Passive and active dendrites
In the app the cell body and axon have the full squid-axon channel density, and a slider sets the dendrites’ share. At zero the dendrites are passive cables. Turned up, they fire spikes of their own, so a jolt at a distant tip can reach the cell body at full strength, and a spike from the cell body also travels back up into the dendrites. Real pyramidal neurons do the second: Stuart and Sakmann recorded spikes travelling back into the dendrites of cortical cells in 1994, and how active dendrites shape what a neuron computes has been studied ever since.
Solved one tree at a time
The neuron is cut into pieces about 8 µm long, each joined to its parent by the resistance of the fluid between them. The voltages of all of them are solved together, implicitly, so the time step is set by the channels and not by the smallest piece. That needs a linear system solved every step, and for a tree it can be done in one pass from the tips in to the root and one pass back out: Michael Hines’s method from 1984, which NEURON and Jaxley both use. The gates are advanced with an exponential step, as is standard. One 25 µs step for a cell of a thousand pieces takes a few tens of microseconds, so the app runs the neuron slowed down, at a few milliseconds of its time per second of yours.
The shape
The neuron on screen is grown by a small program: a cell body, a long apical dendrite branching on its way up, a skirt of shorter basal dendrites, and a thin axon going down. That is the plan of a pyramidal cell in the cortex. Each press of A different neuron grows another. Real reconstructions, traced from microscope images and shared as SWC files on NeuroMorpho.org, can be loaded too. Branches are drawn thicker than they are, or the finest would be invisible.
Checked against what has to be true
The engine is tested for the things that would show a mistake. One step of the tree solver must match a brute-force solve of the same linear system to nine decimal places. A cell left alone must stay at its resting voltage. A spike started at the cell body must reach the far end of the axon, and later than it left. A signal injected into a passive dendrite must arrive at the cell body much smaller than it started. With the default channels, a jolt at any of the dendrite tips of three different generated neurons fires the cell body, which takes 2 to 3 ms.
Small enough to just open
The engine is about 400 lines of Rust compiled to WebAssembly, 70 KB, and the page draws the neuron as tubes in WebGL coloured by voltage. Nothing is sent anywhere, including a loaded SWC file. It is written from the published equations and shares no code with NEURON or Jaxley.
Try it
Open neuron. Press Spike at the cell body, then Jolt a dendrite tip, and watch the voltage traces. Then turn the dendrites’ sodium channels down to zero and jolt a tip again. How it works, on the page, has the details.
Further reading
- A. L. Hodgkin and A. F. Huxley, A quantitative description of membrane current and its application to conduction and excitation in nerve, Journal of Physiology 117 (1952) 500–544. The channels.
- W. Rall, Branching dendritic trees and motoneuron membrane resistivity, Experimental Neurology 1 (1959) 491–527. Cable theory for dendrites.
- M. Hines, Efficient computation of branched nerve equations, International Journal of Bio-Medical Computing 15 (1984) 69–76. The tree solver.
- N. T. Carnevale and M. L. Hines, The NEURON Book, Cambridge University Press (2006). How the standard simulator does it.
- M. Deistler et al., Jaxley: differentiable simulation enables large-scale training of detailed biophysical models of neural dynamics, Nature Methods 22 (2025) 2649–2657. The same calculation, differentiable, for fitting models to data.
- G. J. Stuart and B. Sakmann, Active propagation of somatic action potentials into neocortical pyramidal cell dendrites, Nature 367 (1994) 69–72. Spikes travelling back into the dendrites.
- G. J. Stuart and N. Spruston, Dendritic integration: 60 years of progress, Nature Neuroscience 18 (2015) 1713–1721. A review of what dendrites do.
- R. Makarov, S. Chavlis and P. Poirazi, DendroTweaks, an interactive approach for unraveling dendritic dynamics, eLife 13 (2025). An interactive research tool for tuning detailed neuron models.