# C4.5 algorithm

> Source: https://aiwiki.ai/wiki/c4_5
> Updated: 2026-11-18
> Fact-checked: 2026-11-18
> Categories: AI History, Algorithms, Machine Learning
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) - attribute to "AI Wiki (aiwiki.ai)"
> Cite as: AI Wiki. "C4.5 algorithm." aiwiki.ai, 18 Nov 2026. https://aiwiki.ai/wiki/c4_5
> From AI Wiki (https://aiwiki.ai), the free encyclopedia of artificial intelligence. Reuse freely with attribution.

**C4.5** is a [decision tree](https://aiwiki.ai/wiki/decision_tree) learning algorithm and software system written by J. Ross Quinlan and documented in his book *C4.5: Programs for Machine Learning*, published by Morgan Kaufmann in 1993 [1][2]. It is the successor to Quinlan's [ID3](https://aiwiki.ai/wiki/id3_algorithm), and like ID3 it builds a classifier from labelled examples by recursively partitioning the data, choosing at each step the attribute test that scores best on an information-based criterion [2][3]. C4.5 handles numeric as well as discrete attributes, cases with unknown values and error-based pruning, and offers an alternative output form in which the tree is converted into an ordered list of if-then rules [2]. In December 2006 the IEEE International Conference on Data Mining (ICDM) named C4.5 among its top ten algorithms in [data mining](https://aiwiki.ai/wiki/data_mining), and in 1997 it was superseded by See5/C5.0, a commercial system from Quinlan's company RuleQuest Research [2][4][8]. The last public release, Release 8, can still be downloaded from Quinlan's personal page, which states that C4.5 is no longer supported [5][8].

## History

C4.5 belongs to a line of tree-induction programs that grow trees by divide and conquer, an approach Quinlan credits to Hunt and his co-workers (Hunt, Marin and Stone, 1966) [3]. The 2008 data-mining survey co-authored by Quinlan describes C4.5 as a descendant of an earlier system called CLS and of ID3, which Quinlan first described in 1979 and set out in a widely cited 1986 paper in the first volume of the journal *Machine Learning* [2][7]. ID3 chose, at each node, the categorical attribute with the largest [information gain](https://aiwiki.ai/wiki/information_gain) [14]. C4.5 kept that framework and added the numeric-attribute, unknown-value, pruning and ruleset facilities described below [2].

The copyright notice in the C4.5 source distribution covers the years 1987 to 1992, and the distribution's ReadMe refers readers to the book for a fuller guide to the system [5]. The ReadMe cites the book as a 1992 Morgan Kaufmann title, while the publisher's record and later citations, including Quinlan's own, date it 1993 [1][2][3][5]. According to the survey, research on C4.5 was funded for many years by the Australian Research Council [2]. In his 1996 papers on the system he gave his affiliation as the University of Sydney, in the JAIR paper specifically its Basser Department of Computer Science [3][12]; by 2008 he was listed at RuleQuest Research in St Ives, New South Wales [2].

The source code went through several numbered releases after the book appeared. A change log shipped with the code records bug fixes reported by users, and marks the release points [5]:

| Release | Date | Notable change recorded in the change log |
|---|---|---|
| Release 6 | July 1994 | New coding of exceptions and a greedy search for rule subsets in the rule generator, with simulated annealing kept as an option |
| Release 7 | June 1995 | The exception-coding scheme from the July 1994 changes amended in line with Quinlan's ML'95 paper |
| Release 8 | October 1995 | Revised calculation of gain for continuous attributes, described in "Improved Use of Continuous Attributes in C4.5" |

The Release 8 change is the subject of Quinlan's paper in the *Journal of Artificial Intelligence Research* (JAIR), submitted in October 1995 and published in March 1996 [3]. A final entry, dated February 1996, records minor fixes after Release 8 [5].

## How the algorithm works

### Growing the tree

C4.5 takes a set of training cases, each described by a fixed set of attributes and labelled with one of a small number of classes [2]. It builds the tree top-down. If every case in the current set belongs to one class, or the set is too small, the node becomes a leaf labelled with the most frequent class. Otherwise C4.5 picks a test on a single attribute, creates one branch per outcome, splits the cases among the branches, and repeats the procedure on each subset [2][3]. If every candidate test leaves the class distribution unchanged in all subsets, so that no test has positive gain, the node also becomes a leaf [3].

Two kinds of test are considered by default [3]:

- For a discrete attribute, a test with one outcome per value of the attribute. A command-line option makes C4.5 group the values of a many-valued attribute into subsets, with one branch per subset [2][5].
- For a numeric ([continuous](https://aiwiki.ai/wiki/continuous_feature)) attribute, a binary test of the form $A \le t$. C4.5 sorts the cases on the attribute and evaluates a threshold between each pair of adjacent distinct values [3]. In the Release 8 source, the chosen cut point is then moved down to the largest value of the attribute actually present in the training data that does not exceed it [5].

The program also requires that at least two branches of any test contain a minimum number of training cases, two by default [5].

### Gain and gain ratio

The selection criteria come from [information theory](https://aiwiki.ai/wiki/information_theory). For a set of cases $D$ with $C$ classes, let $p(D, j)$ be the proportion of cases in class $j$. The [entropy](https://aiwiki.ai/wiki/entropy) of the class distribution is

$$\mathrm{Info}(D) = -\sum_{j=1}^{C} p(D, j)\,\log_2 p(D, j)$$

and the information gained by a test $T$ that splits $D$ into subsets $D_1, \dots, D_k$ is given by [3]:

$$\mathrm{Gain}(D, T) = \mathrm{Info}(D) - \sum_{i=1}^{k} \frac{|D_i|}{|D|}\,\mathrm{Info}(D_i)$$

Information gain alone favours tests with many outcomes and is largest when each subset holds a single case [3]. C4.5 therefore defaults to the gain ratio, which divides the gain by the split information

$$\mathrm{Split}(D, T) = -\sum_{i=1}^{k} \frac{|D_i|}{|D|}\,\log_2 \frac{|D_i|}{|D|}$$

a quantity that grows with the number of outcomes [3]. The gain ratio of every candidate test is computed, and among the tests whose gain is at least the average gain, the one with the highest gain ratio is chosen [3]. The source code implements this through a function that returns the ratio only for tests meeting that minimum gain [5]. Plain information gain remains available through the `-g` option [5].

### The Release 8 correction for numeric attributes

Several researchers had reported that C4.5 did comparatively poorly on datasets dominated by continuous attributes [3]. Quinlan's diagnosis was that the freedom to choose a threshold gives a numeric attribute with $N$ distinct values $N - 1$ candidate partitions, which biases selection toward such attributes over discrete ones [3]. Release 8 made two changes [3]:

1. Borrowing from the minimum description length principle, it charges for the extra information needed to say which threshold was used. The apparent gain of a test on a continuous attribute is reduced by $\log_2(N-1)/|D|$. If no threshold's adjusted gain exceeds zero, the attribute is excluded at that node.
2. The threshold is chosen to maximize gain rather than gain ratio. The final choice among attributes is still made by gain ratio, using the adjusted gain.

Quinlan compared Release 8 with Release 7 on twenty datasets from the UCI repository that contain continuous attributes, using ten repetitions of ten-fold [cross-validation](https://aiwiki.ai/wiki/cross-validation) for each dataset and default settings for both versions [3]. On average the pruned Release 8 trees had 4% lower error and were 12% smaller, and Release 8 was less accurate on only four of the twenty tasks [3]. When ten irrelevant continuous and ten irrelevant discrete attributes were added to every dataset, Release 8's pruned trees had 10% lower error on average than Release 7's and were much smaller [3].

### Unknown attribute values

C4.5 accepts cases in which some attribute values are missing, marked with a question mark in the data file [5]. When it evaluates a test, the gain is computed from the cases whose value for that attribute is known and then multiplied by the fraction of cases with a known value, so attributes that are often missing are penalized [5]. Cases with unknown values are apportioned probabilistically among the outcomes rather than routed by a substitute test [2]. At classification time, a case whose tested value is unknown is sent down every branch, with weights proportional to the number of training cases that went down each branch, and the case is assigned the class with the largest total weight [5]. The survey contrasts this with [CART](https://aiwiki.ai/wiki/cart_algorithm), which looks for surrogate tests that mimic the missing one [2].

### Pruning

The fully grown tree usually [overfits](https://aiwiki.ai/wiki/overfitting) noisy data, so C4.5 [prunes](https://aiwiki.ai/wiki/pruning) it [2][3]. Instead of using the observed error rate $E/N$ at a node with $N$ training cases and $E$ errors, C4.5 uses a pessimistic estimate: the upper limit of the binomial error probability given $E$ errors in $N$ trials, at a user-set confidence level whose default is 25% [2][5]. Pruning works from the leaves toward the root in a single pass. At each subtree, C4.5 compares the summed estimated errors of its branches with the estimated errors of a single leaf; if the leaf is no worse, the subtree is replaced by the leaf. It also checks whether replacing the subtree by one of its branches would lower the estimate, and if so makes that substitution [2]. In the Release 8 code the branch considered is the one that received the most training cases [5].

### Windowing

Besides the default batch mode, the `c4.5` program offers an iterative mode. It starts from a random subset of the training data (the window), builds a tree, adds some of the misclassified cases from outside the window, and repeats until the tree classifies all the remaining cases correctly or progress stalls [5]. Because the starting window is random, several trials can produce different trees, and the program keeps the best pruned tree [5]. By default the initial window holds the larger of 20% of the cases and twice the square root of the number of cases [5].

## Rulesets

Large trees are hard to read, partly because the information about a single class is often spread across many leaves [2]. C4.5 therefore offered a second classifier form: an ordered list of rules such as "if A and B and C then class X", grouped by class, with a default class for cases no rule covers. A case is classified by the first rule whose conditions it satisfies [2].

The rule generator, `c4.5rules`, starts from the unpruned tree. Every root-to-leaf path becomes a candidate rule. Each rule is then simplified by hill climbing: conditions are dropped one at a time when doing so lowers the rule's pessimistic error estimate. Next, a subset of the simplified rules is chosen for each class, the class subsets are ordered to minimize training error, and a default class is picked [2]. The final ruleset usually contains far fewer rules than the pruned tree has leaves [2].

The survey names computational cost as the main drawback of these rulesets. In one experiment it cites, growing the sample from 10,000 to 100,000 cases raised tree-building time on a PC from 1.4 to 61 seconds, but raised ruleset time from 32 to 9,715 seconds [2].

## Software

The Release 8 distribution is C source code targeted at Berkeley BSD 4.3 Unix [5]. It contains four main programs and some tools for experiments [5]:

| Program | Purpose |
|---|---|
| `c4.5` | Builds decision trees (pruned and unpruned) |
| `c4.5rules` | Builds production rules from trees |
| `consult` | Classifies cases entered by the user, using a saved tree |
| `consultr` | Classifies cases entered by the user, using a saved ruleset |
| `xval.sh`, `xval-prep`, `average` | Run and summarize cross-validation experiments |

Input uses plain-text files sharing a file stem: a `.names` file declares the classes and the attributes (as a list of values, `continuous`, `discrete N`, or `ignore`), a `.data` file holds one comma-separated case per line, and an optional `.test` file holds unseen cases for evaluation [5]. The distribution includes small sample datasets, among them `golf`, `labor-neg`, `vote`, `hypo`, `crx`, `soybean` and three MONK's problems [5]. Key options include `-m` (minimum cases, default 2), `-c` (pruning confidence, default 25%), `-s` (value subsetting), `-g` (gain instead of gain ratio), `-p` (probabilistic thresholds for continuous attributes) and `-t` (number of windowing trials) [5].

The ReadMe states that the software may not be distributed without the copyright holder's permission, and Quinlan's homepage asks users to note restrictions on distribution [5][8]. The 2008 survey describes C4.5 as freely available for research and teaching [2].

## Comparison with CART and ID3

The 2008 survey summarizes how C4.5's tree construction differs from CART, the method of Breiman, Friedman, Olshen and Stone [2]:

| Aspect | C4.5 | CART |
|---|---|---|
| Test outcomes | Two or more | Always two |
| Split criterion | Information gain or gain ratio | Gini diversity index |
| Pruning | Single pass using binomial confidence limits | Cost-complexity pruning with parameters set by cross-validation |
| Unknown values | Case apportioned probabilistically among outcomes | Surrogate tests |

The scikit-learn documentation adds that CART supports numeric target variables ([regression](https://aiwiki.ai/wiki/regression)) and does not compute rulesets, and it summarizes C4.5's main advance over ID3 as removing the restriction that features be categorical [14].

## Influence

### ICDM top ten

In 2006 the ICDM organizers ran a three-step process to identify the most influential data-mining algorithms. Winners of the ACM KDD Innovation Award and the IEEE ICDM Research Contributions Award were invited in September 2006 to nominate up to ten algorithms each; nominations with fewer than 50 Google Scholar citations in late October 2006 were dropped, leaving 18; program committee members of KDD-06, ICDM '06 and SDM '06 then voted, and an open vote of 145 attendees at the ICDM '06 panel in Hong Kong on 21 December 2006 produced the same top ten [2]. The list was C4.5, [k-means](https://aiwiki.ai/wiki/k-means), [support vector machines](https://aiwiki.ai/wiki/support_vector_machine_svm), Apriori, [EM](https://aiwiki.ai/wiki/expectation_maximization), PageRank, [AdaBoost](https://aiwiki.ai/wiki/adaboost), [kNN](https://aiwiki.ai/wiki/k_nearest_neighbors), [naive Bayes](https://aiwiki.ai/wiki/naive_bayes) and CART, and the resulting survey in *Knowledge and Information Systems* opens with a section on C4.5; Quinlan is one of its co-authors [2].

### Base learner for ensembles

C4.5 was a common base learner in early [ensemble learning](https://aiwiki.ai/wiki/ensemble_learning) research. In "Bagging, Boosting, and C4.5", presented at AAAI-96, Quinlan applied Breiman's [bagging](https://aiwiki.ai/wiki/bagging) and Freund and Schapire's [boosting](https://aiwiki.ai/wiki/boosting) to C4.5 on 27 UCI datasets [12]. Bagging cut C4.5's error by about 10% on average and beat it on 24 of the 27 datasets. Boosting cut error by 15% but improved only 21 datasets and made six worse, and boosting beat bagging head to head on 20 of the 27 [12]. With a modified voting scheme, boosting reduced C4.5's error on the 20,000-case letter dataset from 12% to 4.5% [12]. Quinlan noted that both methods multiply computation by the number of classifiers generated [12].

Thomas Dietterich's 2000 study in *Machine Learning* compared bagging, boosting and a third method that randomizes C4.5's own split choice. Starting from C4.5 Release 1, his randomized version computed the 20 best candidate splits at each node and picked one of them uniformly at random [13]. Across 33 UCI tasks, he found randomization competitive with bagging but less accurate than boosting when there was little classification noise, while with substantial noise bagging did much better than boosting [13].

## Successor: See5/C5.0

C4.5 was superseded in 1997 by See5/C5.0, a commercial system from RuleQuest Research [2][4]. See5 is the Windows version and C5.0 its Linux counterpart [15]. The 2008 survey lists its main changes as a boosting variant, new data types such as dates, "not applicable" values, variable misclassification costs, attribute pre-filtering, unordered rulesets in which all matching rules vote, and much better scalability, including multi-threading [2]. RuleQuest later released single-threaded Linux source code for C5.0 under the GNU General Public License, as Release 2.07 GPL Edition [9]. As of November 2026 the RuleQuest homepage lists See5/C5.0 version 2.11a [10]. In [R](https://aiwiki.ai/wiki/r_programming_language), the `C50` package on CRAN builds C5.0 models with imported C code by Quinlan and RuleQuest, under the GPL-3 licence [11].

RuleQuest's own comparison of C4.5 Release 8 with C5.0 Release 2.07 GPL Edition used three large datasets, training on half of each and testing on the other half, on an Intel Core i7-6700 desktop [4]. For rulesets it reported:

| Dataset | C4.5 error | C5.0 error | C4.5 rules | C5.0 rules | C4.5 time (s) | C5.0 time (s) |
|---|---|---|---|---|---|---|
| sleep (105,908 cases) | 26.9% | 26.0% | 710 | 830 | 3,234 | 12 |
| income (199,523 cases) | 5.0% | 5.0% | 190 | 84 | 2,782 | 4 |
| forest (581,012 cases) | 6.8% | 5.9% | 5,316 | 4,269 | 30,115 | 170 |

For the forest cover data, the page states that C4.5 needed more than 3 GB of memory to build its ruleset while C5.0 used less than 200 MB [4]. For decision trees, C5.0's trees were noticeably smaller and 3 to 15 times faster to build, with similar or slightly lower error [4]. These figures come from the vendor of C5.0.

## Implementations

The C4.5 program itself is still distributed as Release 8 source [5][8]. The Weka toolkit includes a reimplementation, `J48`, whose documentation describes it as a class for generating a pruned or unpruned C4.5 decision tree and cites Quinlan's 1993 book [6]. J48's options mirror C4.5's: a pruning confidence (default 0.25), a minimum number of instances per leaf (default 2), subtree raising, binary splits only, and a switch to disable the MDL correction for numeric attributes; it also offers reduced-error pruning as an alternative [6].

[scikit-learn](https://aiwiki.ai/wiki/scikit_learn) does not implement C4.5. Its documentation says it uses an optimized version of CART and, as of version 1.9.1, does not support categorical variables in its tree implementation [14].

## Limitations

- **Bias toward continuous attributes before Release 8.** Quinlan's 1996 paper quotes other researchers who found C4.5 weaker on datasets made up mostly of continuous attributes, which motivated the threshold penalty [3].
- **Cost of rulesets.** The ruleset generator was slow and memory-hungry on large data; RuleQuest describes C5.0 as using new algorithms for generating rulesets [2][4].
- **Instability.** The 2008 survey notes that on a 20,000-case letter recognition dataset, C4.5's error on its own training cases was 4% while leave-one-out cross-validation gave 11.7%, which shows how much a single omitted case can change the tree. It lists building trees that are stable under such changes as an open research problem [2].
- **Boosting can hurt.** In Quinlan's AAAI-96 trials, boosted C4.5 was worse than plain C4.5 on six of 27 datasets [12].

## See also

- [Decision tree](https://aiwiki.ai/wiki/decision_tree)
- [ID3 algorithm](https://aiwiki.ai/wiki/id3_algorithm)
- [CART algorithm](https://aiwiki.ai/wiki/cart_algorithm)
- [Random forest](https://aiwiki.ai/wiki/random_forest)
- [Gradient boosting](https://aiwiki.ai/wiki/gradient_boosting)
- [Information gain](https://aiwiki.ai/wiki/information_gain)

## References

1. Quinlan, J. Ross. "C4.5: Programs for Machine Learning". Morgan Kaufmann (Elsevier), 1993. https://doi.org/10.1016/C2009-0-27846-9
2. Wu, Xindong; Kumar, Vipin; Quinlan, J. Ross; Ghosh, Joydeep; Yang, Qiang; Motoda, Hiroshi; McLachlan, Geoffrey J.; Ng, Angus; Liu, Bing; Yu, Philip S.; Zhou, Zhi-Hua; Steinbach, Michael; Hand, David J.; Steinberg, Dan. "Top 10 algorithms in data mining". Knowledge and Information Systems 14, 1-37, 2008 (online 4 December 2007). https://doi.org/10.1007/s10115-007-0114-2
3. Quinlan, J. R. "Improved Use of Continuous Attributes in C4.5". Journal of Artificial Intelligence Research 4, 77-90, 1996. https://arxiv.org/abs/cs/9603103
4. RuleQuest Research. "Is See5/C5.0 Better Than C4.5?". RuleQuest Research, last updated February 2017. https://www.rulequest.com/see5-comparison.html
5. Quinlan, J. R. "C4.5 Release 8" source distribution (ReadMe, LEGAL, Doc/c4.5.1, Src/Modifications and source files). RuleQuest Research. https://www.rulequest.com/Personal/c4.5r8.tar.gz
6. Frank, Eibe. "J48" class documentation. Weka. https://weka.sourceforge.io/doc.dev/weka/classifiers/trees/J48.html
7. Quinlan, J. R. "Induction of Decision Trees". Machine Learning 1(1), 81-106, 1986. https://doi.org/10.1007/BF00116251
8. Quinlan, Ross. "Ross Quinlan's personal homepage". RuleQuest Research. https://www.rulequest.com/Personal/
9. RuleQuest Research. "Free Software Downloads". RuleQuest Research, last updated April 2022. https://www.rulequest.com/download.html
10. RuleQuest Research. "RuleQuest Research Data Mining Tools". RuleQuest Research, accessed November 2026. https://www.rulequest.com/
11. Kuhn, Max; et al. "C50: C5.0 Decision Trees and Rule-Based Models". CRAN, version 0.2.0, 2025-04-03. https://cran.r-project.org/package=C50
12. Quinlan, J. R. "Bagging, Boosting, and C4.5". Proceedings of the Thirteenth National Conference on Artificial Intelligence (AAAI-96), 725-730, 1996. https://www.rulequest.com/Personal/q.aaai96.ps
13. Dietterich, Thomas G. "An Experimental Comparison of Three Methods for Constructing Ensembles of Decision Trees: Bagging, Boosting, and Randomization". Machine Learning 40, 139-157, 2000. https://doi.org/10.1023/A:1007607513941
14. scikit-learn developers. "1.10. Decision Trees". scikit-learn 1.9.1 documentation. https://scikit-learn.org/stable/modules/tree.html
15. RuleQuest Research. "Information on See5/C5.0". RuleQuest Research. https://www.rulequest.com/see5-info.html

