"We are not among those communists who are out to destroy personal liberty, who wish to turn the world into one huge barrack or into a gigantic workhouse. There certainly are some communists who, with an easy conscience, refuse to countenance personal liberty and would like to shuffle it out of the world because they consider that it is a hindrance to complete harmony. But we have no desire to exchange freedom for equality. We are convinced that in no social order will freedom be assured as in a society based upon communal ownership." — Marx, Engel, et al., Communist Journal, 1847Right-libertarians will insist Marx was no libertarian because they've been doing their best to appropriate the word. If you want to quibble, Marx was a left-libertarian, as spelled out in one of his more famous quotes:
"In communist society, where nobody has one exclusive sphere of activity but each can become accomplished in any branch he wishes, society regulates the general production and thus makes it possible for me to do one thing today and another tomorrow, to hunt in the morning, fish in the afternoon, rear cattle in the evening, criticise after dinner, just as I have a mind, without ever becoming hunter, fisherman, herdsman or critic." —Marx, German Ideology, 1845As for Marx's mention that some socialists would turn the world in one huge barrack or workhouse, that's the goal of all capitalists—the nicer ones simply want nicer workhouses. Marx's libertarian socialism had no room for authoritarian or hierarchical socialists.