The primary/secondary quality distinction is a conceptual distinction in epistemology and metaphysics, concerning the nature of reality. It is most explicitly articulated by John Locke in his Essay concerning Human Understanding, but earlier thinkers such as Galileo and Descartes made similar distinctions.
Primary qualities are thought to be properties of objects that are independent of any observer, such as solidity, extension, motion, number and figure. These characteristics convey facts. They exist in the thing itself, can be determined with certainty, and do not rely on subjective judgments. For example, if an object is spherical, no one can reasonably argue that it is triangular. Primary qualities as mentioned earlier, exist outside of the observer. They inhere to an object in such a way that if the object was changed, i.e. divided, the primary qualities would remain. When dividing an object, “solidity, extension, figure, and mobility”  would not be altered because the primary qualities are built into the object itself. Another key component of primary qualities is that they create ideas in our minds through experience; they represent the actual object. Because of this, primary qualities such as size, weight, solidity, motion, and so forth can all be measured in some form. Using an apple as an example, the shape and size can actually be measured and produce the idea in our minds of what the object is. A clear distinction to make is that qualities do not exist in the mind, rather they produce ideas in our minds and exist within the objects. In the case of primary qualities, they exist inside the actual body/substance and create an idea in our mind that resembles the object.
Secondary qualities are thought to be properties that produce sensations in observers, such as color, taste, smell, and sound. They can be described as the effect things have on certain people. Secondary qualities use the power of reflection in order to be perceived by our minds. These qualities “would ordinarily be said to be only a power in rather than a quality of the object”. They are sensible qualities that produce different ideas in our mind from the actual object. Going back the example of apple, something such as the redness of the apple does not produce an image of the object itself, but rather the idea of red. Secondary qualities are used to classify similar ideas produced by an object. That is why when we see something “red” it is only “red” in our minds because they produce the same idea as another object. So, going back to the color of the apple, it produces an idea of red, which we classify and identify with other red ideas. Again, secondary qualities do not exist inside the mind; they are simply the powers that allow us to sense a certain object and thus ‘reflect’ and classify similar ideas.
According to the theory, primary qualities are measurable aspects of physical reality; secondary qualities are subjective.
Gottfried Leibniz was an early critic of the distinction, writing in his 1686 Discourse on Metaphysics that "[i]t is even possible to demonstrate that the ideas of size, figure and motion are not so distinctive as is imagined, and that they stand for something imaginary relative to our perceptions as do, although to a greater extent, the ideas of color, heat, and the other similar qualities in regard to which we may doubt whether they are actually to be found in the nature of the things outside of us."
George Berkeley wrote his famous critique of this distinction in his book Three Dialogues between Hylas and Philonous. Berkeley maintained that the ideas created by sensations are all that people can know for sure. As a result, what is perceived as real consists only of ideas in the mind. The crux of Berkeley's argument is that once an object is stripped of all its secondary qualities, it becomes very problematic to assign any acceptable meaning to the idea that there is some object. Not that one cannot picture to oneself (in one's mind) that some object could exist apart from any perceiver — one clearly can do this — but rather, that one cannot give any content to this idea. Suppose that someone says that a particular mind-independent object (meaning, an object free of all secondary qualities) exists at some time and some place. Now, none of this particularly means anything if one cannot specify a place and time. In that case it's still a purely imaginary, empty idea. This is not generally thought to be a problem because realists imagine that they can, in fact, specify a place and time for a 'mind-independent' object. What is overlooked is that they can only specify a place and time in place and time as we experience them. Berkeley did not doubt that one can do this, but that it is objective. One has simply related ideas to experiences (the idea of an object to our experiences of space and time). In this case there is no space and time, and therefore no objectivity. Space and time as we experience them are always piecemeal (even when the piece of space is big, as in some astronomical photos), it is only in imagination that they are total and all-encompassing, which is how we definitely imagine (!) 'real' space and time as being. This is why Berkeley argued that the materialist has merely an idea of an unperceived object: because people typically do take our imagining or picturing, as guaranteeing an objective reality to the 'existence' of 'something'. In no adequate way has it been specified nor given any acceptable meaning. As such Berkeley comes to his conclusion that having a compelling image in the mind, one which connects to no specifiable thing external to us, does not guarantee an objective existence.
David Hume also criticized the distinction, although for reasons altogether fairly similar to those of Berkeley and Leibniz. In Book 1, Part 4 of A Treatise of Human Nature, he argues that we have no impressions of primary qualities at all, but rather only various impressions that we tend to group together into some particular mind-independent quality. Thus, according to Hume, primary qualities collapse into secondary qualities, making the distinction far less helpful than it first might have seemed.
Immanuel Kant, in his Prolegomena to Any Future Metaphysics That Will Be Able to Present Itself as a Science, claimed that primary, as well as secondary, qualities are subjective. They are both mere appearances that are located in the mind of a knowing observer. In § 13, Remark II, he wrote: "Long before Locke's time, but assuredly since him, it has been generally assumed and granted without detriment to the actual existence of external things, that many of their predicates may be said to belong not to the things in themselves, but to their appearances, and to have no proper existence outside our representation. Heat, color, and taste, for instance, are of this kind. Now, if I go farther, and for weighty reasons rank as mere appearances the remaining qualities of bodies also, which are called primary, such as extension, place, and in general space, with all that which belongs to it (impenetrability or materiality, space, etc.)—no one in the least can adduce the reason of its being inadmissible." This follows directly from Kant's transcendental idealism, according to which space and time are mere forms of intuition, which means that any quality that can be attributed to the spatiotemporal objects of experience must be a quality of how things appear to us rather than of how things are in themselves. Thus, while Kant did not deny the existence of objects beyond all possible experience, he did deny the applicability of primary quality terms to things in themselves.