Karl Marx (1818-83) was born into a middle-class family in Germany. At university he was one of many radically-minded philosophers. In his mid-20s, partly under the influence of workers' socialist groups he met during a stay in Paris, he decided to throw in his lot with the working class then emerging as a social force in Europe.
He joined a group called the Communist League and wrote the famous Communist Manifesto for it. That appeared in early 1848. Within a few days revolutionary upheavals exploded in France and Germany (then ruled by monarchies, with very little space for democracy). From June 1848 to May 1849 Marx edited a revolutionary newspaper, the Neue Rheinische Zeitung, in Cologne. As the revolution ebbed, he had to seek exile in Britain, and lived in London for the rest of his life.
There were many socialists and communists before Marx. But, in short pamphlets like the Communist Manifesto and in longer, more analytical books like Capital (1867), Marx developed a new perspective for socialism - no longer based on presenting blueprints for an ideal society to humanity in general, or on semi-military conspiracies, but on struggles for democracy and for better conditions by the working class generated by capitalism itself.
During Marx's life, his sort of socialism was a small minority force. He was unworried by being at odds with "public opinion", concluding his preface to Capital with a phrase from Dante: "Go your own way, and let the people talk". But he was active in the International Workingmen's Association, the first workers' international, from its founding in 1864 until it shattered in the reaction after the Paris Commune of 1871.
Marx and his co-thinker Frederick Engels (1821-95) helped socialists form workers' parties in Germany and France. They campaigned for solidarity with the anti-slavery struggle in the US civil war, with national struggles in Poland, with the Paris Commune, and with socialists forced into exile after the defeat of the Commune.
Mass workers' parties and trade unions developed in Europe in the decades between Marx's death and World War 1 (1914). Until his death in 1895, Engels was a respected (but not always heeded) adviser to those new labour movements.