In physics, scalars (or scalar quantities) are physical quantities that are unaffected by changes to a vector space basis (i.e., a coordinate system transformation). Scalars are often accompanied by units of measurement, as in "10 cm". A change of a vector space basis changes the description of a vector in terms of the basis used but does not change the vector itself, while a scalar has nothing to do with this change. This physical definition of scalars, in classical theories, like Newtonian mechanics, means that rotations or reflections preserve scalars, while in relativistic theories, Lorentz transformations or space-time translations preserve scalars.
A scalar in physics is also a scalar in mathematics (as an element of a field used to define a vector space). The magnitude (or length) of an electric field vector is calculated as the square root of the inner product of the electric field with itself and the outcome of the inner product is an element of the field for the vector space in which the electric field is described. As the field for the vector space in this example and usual cases in physics is the field of real numbers or complex numbers, the square root of the inner product is also an element of the field so it is a mathematically scalar. Since the inner product is independent of any vector space basis, the electric field magnitude is also a physically scalar. For a mass of an object that is unaffected by a change of a vector space basis so is a physically scalar, it is described by a real number as an element of the real number field. Since a field F is a vector space F over a field F, where addition defined on F is vector addition and multiplication defined on F is scalar multiplication, the mass is also a mathematically scalar. Other quantities such as a distance, charge, volume, time, speed (the magnitude of a velocity vector) are also mathematically and physically scalars in similar senses.
Since scalars mostly may be treated as special cases of multi-dimensional quantities such as vectors and tensors, physical scalar fields might be regarded as a special case of more general fields, like vector fields, spinor fields, and tensor fields.
Like other physical quantities, a physical quantity of scalar is also typically expressed by a numerical value and a physical unit, not merely a number, to provide its physical meaning. It may be regarded as the product of the number and the unit (e.g., 1 km as a physical distance is the same as 1,000 m). A physical distance does not depend on the length of each base vector of the coordinate system where the base vector length corresponds to the physical distance unit in use. (E.g., 1 m base vector length means the meter unit is used.) A physical distance differs from a metric in the sense that it is not just a real number while the metric is calculated to a real number, but the metric can be converted to the physical distance by converting each base vector length to the corresponding physical unit.
Any change of a coordinate system may affect the formula for computing scalars (for example, the Euclidean formula for distance in terms of coordinates relies on the basis being orthonormal), but not the scalars themselves. Vectors themselves also do not change by a change of a coordinate system, but their descriptions changes (e.g., a change of numbers representing a position vector by rotating a coordinate system in use).
An example of a scalar quantity is temperature: The temperature at a given point is a single number. Velocity, on the other hand, is a vector quantity.
Some examples of scalar quantities in physics are mass, charge, volume, time, speed, and electric potential at a point inside a medium. The distance between two points in three-dimensional space is a scalar, but the direction from one of those points to the other is not, since describing a direction requires two physical quantities such as the angle on the horizontal plane and the angle away from that plane. Force cannot be described using a scalar, since force has both direction and magnitude; however, the magnitude of a force alone can be described with a scalar, for instance the gravitational force acting on a particle is not a scalar, but its magnitude is. The speed of an object is a scalar (e.g. 180 km/h), while its velocity is not (e.g. 108 km/h northward and 144 km/h westward). Some other examples of scalar quantities in Newtonian mechanics are electric charge and charge density.
In the theory of relativity, one considers changes of coordinate systems that trade space for time. As a consequence, several physical quantities that are scalars in "classical" (non-relativistic) physics need to be combined with other quantities and treated as four-vectors or tensors. For example, the charge density at a point in a medium, which is a scalar in classical physics, must be combined with the local current density (a 3-vector) to comprise a relativistic 4-vector. Similarly, energy density must be combined with momentum density and pressure into the stress–energy tensor.