A galaxy is a group of many stars, with gas, dust, and dark matter.[1][2][3][4] The name 'galaxy' is taken from the Greek word galaxia meaning milky, a reference to our own galaxy, the Milky Way.

Gravity holds galaxies together against the general expansion of the universe.[3] In effect, the expansion of the universe takes place between groups of galaxies, not inside those groups. Gravity holds the galaxy together, and the same applies to  groups of galaxies, such as our Local Group in the Milky Way. The gravitation is produced by the matter and energy in a galaxy or group of galaxies. Everything in a galaxy moves around a centre of mass, which is also an effect of gravity.

There are various types of galaxies: elliptical, spiral and lenticular galaxies, which can all be with or without bars. Then there are irregular galaxies. All galaxies exist inside the universe. The observable Universe contains more than 2 trillion (1012) galaxies[5] and, overall, as many as an estimated 1×1024 stars[6][7] (more stars than all the grains of sand on planet Earth).[8]

There are galaxies of different sizes. Typical galaxies range from dwarfs with as few as ten million[3][9] (107) stars up to giants with a hundred trillion[3][10] (1014) stars, all orbiting the galaxy's center of mass. Galaxies may contain many multiple star systems, star clusters, and various interstellar clouds. The Sun is one of the stars in the Milky Way galaxy; the Solar System includes the Earth and all the other objects that orbit the Sun.

Star clusters are not galaxies, they are inside galaxies. Globular clusters are spherical-shaped star clusters which are part of the outer halo of the Milky Way. One of the largest (and oldest) known star clusters, Messier 15, has several million stars, packed closely together, with a black hole at its centre. The stars are too closely packed to get an accurate count, but it certainly has more stars than some of the smaller galaxies.

Within galaxy clusters, galaxies move relative to other galaxies. They can and do collide. When this happens, the stars generally move past each other, but gas clouds and dust interact, and can form a burst of new stars. Gravity pulls both galaxies into somewhat new shapes, forming bars, rings or tail-like structures.

Many galaxies continue to form new generations of stars. The Milky Way, and all spiral shaped galaxies like it (see right side image of NGC 2997), produce new stars at a rate of one or two stars per year. This star formation happens in the vast interstellar clouds that account for about 1% to 10% of the mass of these galaxies. Globular star clusters, on the other hand, are not currently forming stars because this activity happened billions of years ago and then stopped once all of the gas and dust clouds were used up.

In the astronomical literature, the word 'Galaxy' with a capital G is used for our galaxy, the Milky Way. The billions of other galaxies are written as 'galaxy' with a lowercase g. The term Milky Way first came out in the English language in a poem by Chaucer.

When William Herschel wrote his catalogue of deep sky objects, he used the name spiral nebula for objects like the Andromeda Galaxy. 200 years later astronomers discovered that they are made of stars as the Milky Way is, so the term 'nebula' is now only used for diffuse structures within a galaxy.

There are two main kinds of galaxies, spiral galaxy and elliptical galaxy. They are classified according to the Hubble Sequence.

A spiral galaxy is a galaxy that has a spiral shape. Most of the galaxies in the universe observed by astronomers are spiral galaxies (about 77%).[12]

They are divided into two :

NGC 1300 and NGC 1672 are examples of barred spiral galaxies.  Whirlpool galaxy and Messier 81 are examples of unbarred spiral galaxies.

The identifying characteristics of a spiral galaxy are disk-shaped rotating, spiral arms, and a bulge in the galactic core.  The spiral arms are where new hot stars are born.  "Bulge" in the galactic core has old stars.  This feature is common to the most spiral galaxies.

An elliptical galaxy is a galaxy that has a ellipsoid (3D of ellipse) shape.  This type of galaxy are dominant in universe, especially in galaxy clusters.  The shape range from circle, ellipse, and cigar-shaped.  In Hubble Sequence, this shape can be represented as class :

Elliptical galaxy can have a large range size. The giant elliptical galaxy can be over a more 1 million light year and the smallest (know as "dwarf elliptical galaxy") are less than one-tenth the size of Milky Way[13] The size of an elliptical galaxy can be measured as an effective radius which defines the area from which half its light comes. The mass of elliptical galaxy is also large. A giant elliptical galaxy can have mass of 1013 (many trillions) of solar masses.[14]

A lenticular galaxy is a galaxy seen in a disc shape.  Determining the shape of a lenticular galaxy is difficult because the shape can be between spiral galaxy and elliptical galaxy.  The shape can be known by looking at the bulge of the galactic center.  If the bulge is very bright, it is a spiral galaxy[15]