StringBuffer is synchronized, StringBuilder is not.
GeeksforGeeks
geeksforgeeks.org โบ java โบ stringbuffer-vs-stringbuilder
StringBuffer vs StringBuilder in Java - GeeksforGeeks
StringBuffer is thread-safe and synchronized, whereas StringBuilder is not synchronized and not thread-safe. StringBuffer is slower in performance, whereas StringBuilder is faster and more efficient for single-threaded applications.
Published: May 28, 2026
Top answer 1 of 16
1796
StringBuffer is synchronized, StringBuilder is not.
2 of 16
767
StringBuilder is faster than StringBuffer because it's not synchronized.
Here's a simple benchmark test:
public class Main {
public static void main(String[] args) {
int N = 77777777;
long t;
{
StringBuffer sb = new StringBuffer();
t = System.currentTimeMillis();
for (int i = N; i > 0 ; i--) {
sb.append("");
}
System.out.println(System.currentTimeMillis() - t);
}
{
StringBuilder sb = new StringBuilder();
t = System.currentTimeMillis();
for (int i = N; i > 0 ; i--) {
sb.append("");
}
System.out.println(System.currentTimeMillis() - t);
}
}
}
A test run gives the numbers of 2241 ms for StringBuffer vs 753 ms for StringBuilder.
Difference between StringBuffer and StringBuilder?
One is thread safe, one isn't. More often than not, you're using an object that lasts the life of a method, and StringBuilder is what you should use. There is a small overhead with StringBuffer to make it thread safe. More on reddit.com
StringBuffer vs StringBuilder in Java
Hey everyone! We just dropped a new blog post comparing StringBuffer and StringBuilder โ two classes that often confuse Java developers. In thisโฆ More on reddit.com
When and why to use StringBuilder over operator and StringBuffer?
StringBuilder does less memory reallocation, so if you're doing a series of repeated operations building up a string, you're better off using that. More on reddit.com
[Java] What exactly is stringBuilder and why use it instead of a traditional String?
If I remember correctly, Java will do things in memory that you might not be aware of. String is an example of this, it will allocate additional memory because it creates a new string object when doing += in Java More on reddit.com
04:47
String vs StringBuilder vs StringBuffer in Java - YouTube
00:56
Java Quiz 19 - What is the difference between StringBuilder and ...
05:41
#36 StringBuffer and StringBuilder in Java - YouTube
Java Strings Part 2 | All String Methods + StringBuilder vs ...
18:20
String vs StringBuilder vs StringBuffer in Java | Key Differences ...
13:15
Java String vs StringBuilder vs StringBuffer: Best Practices & ...
GeeksforGeeks
geeksforgeeks.org โบ java โบ string-vs-stringbuilder-vs-stringbuffer-in-java
String vs StringBuilder vs StringBuffer in Java - GeeksforGeeks
April 23, 2026 - If a string can change (for example: ... is good enough. If a string can change and will be accessed from multiple threads, use a StringBuffer because StringBuffer is synchronous, so you have thread-safety....
Tutorialspoint
tutorialspoint.com โบ java โบ java_string_buffer.htm
String Buffer and String Builder Classes
It is recommended to use StringBuilder whenever possible because it is faster than StringBuffer.
Stack Abuse
stackabuse.com โบ string-vs-stringbuilder-vs-stringbuffer-in-java
String vs StringBuilder vs StringBuffer in Java
July 1, 2019 - Time needed for 50000 String concatenations: 18108ms Time needed for 50000 StringBuffer appends: 7ms Time needed for 50000 StringBuilder appends: 3ms ยท This output may vary depending on your Java Virtual Machine. So from this benchmark test we can see that StringBuilder is the fastest in string manipulation.
Edureka
edureka.co โบ blog โบ string-vs-stringbuffer-vs-stringbuilder
String vs StringBuilder vs StringBuffer in Java | Edureka
March 29, 2022 - A string is an object which represents a sequence of characters. Strings are one of the most popular classes used while programming in Java by developers. But, since Strings are immutable, Java came up with two utility classes: StringBuilder and StringBuffer to make the String manipulations easy.