String is immutable and as a result every new string value is a new String object. This makes the string manipulation with String slow, so Java(since beginning) provided a StringBuffer for string manipulation and made it thread-safe. Since it is thread-safe, every method is synchronized. Since most of the time StringBuffer was used in a single-threaded environment, it was unnecessary to pay the performance penalty due to synchronization, so in Java 5, “they” introduced StringBuilder as a drop-in replacement for StringBuffer.

StringBuffer is synchronized, StringBuilder is not synchronized.