StringUtils.isBlank() checks that each character of the string is a whitespace character (or that the string is empty or that it's null). This is totally different than just checking if the string is empty.

From the linked documentation:

Checks if a String is whitespace, empty ("") or null.

 StringUtils.isBlank(null)      = true
 StringUtils.isBlank("")        = true  
 StringUtils.isBlank(" ")       = true  
 StringUtils.isBlank("bob")     = false  
 StringUtils.isBlank("  bob  ") = false

For comparison StringUtils.isEmpty:

 StringUtils.isEmpty(null)      = true
 StringUtils.isEmpty("")        = true  
 StringUtils.isEmpty(" ")       = false  
 StringUtils.isEmpty("bob")     = false  
 StringUtils.isEmpty("  bob  ") = false

Warning: In java.lang.String.isBlank() and java.lang.String.isEmpty() work the same except they don't return true for null.

java.lang.String.isBlank() (since Java 11)

java.lang.String.isEmpty()

Answer from arshajii on Stack Overflow
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-2.6 › src-html › org › apache › commons › lang › StringUtils.html
StringUtils.isBlank - Apache Commons
184 * StringUtils.isEmpty(" bob ") = false · 185 * </pre> 186 * 187 * <p>NOTE: This method changed in Lang version 2.0. 188 * It no longer trims the String. 189 * That functionality is available in isBlank().</p> 190 * 191 * @param str the String to check, may be null ·
🌐
Educative
educative.io › answers › what-is-stringutilsisblank-in-java
What is StringUtils.isBlank in Java?
import org.apache.commons.lang3.StringUtils; public static boolean isBlank(final CharSequence cs) final CharSequence cs: The character sequence/string to check. This method returns true if the string is blank. Otherwise, it returns false. string ...
🌐
Eduardo Figueiredo
homepages.dcc.ufmg.br › ~andrehora › examples › org.apache.commons.lang3.StringUtils.isBlank.11.html
org.apache.commons.lang3.StringUtils.isBlank
StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false · String someWhiteSpace = " \t \n"; StringUtils.isEmpty(someWhiteSpace); // false StringUtils.isBlank(someWhiteSpace); // true
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-2.6 › org › apache › commons › lang › StringUtils.html
StringUtils (Commons Lang 2.6 API)
public class StringUtils · extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals - compares two strings null-safe · startsWith - check if a String starts with a prefix ...
🌐
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › src-html › org › apache › commons › lang3 › StringUtils.html
StringUtils.isBlank - Source code - Apache Software Foundation
1525 * @param defaultStr the default CharSequence to return if {@code str} is {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or 1526 * {@code null}); may be null. 1527 * @return the passed in CharSequence, or the default. 1528 * @see StringUtils#defaultString(String, String) 1529 * @see #isBlank(CharSequence) 1530 */ 1531 public static <T extends CharSequence> T defaultIfBlank(final T str, final T defaultStr) { 1532 return isBlank(str) ?
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.9 › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.9 API)
IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace ... The StringUtils class defines certain words related to String handling.
🌐
Educative
educative.io › answers › what-is-stringutilsisnotblank-in-java
What is StringUtils.isNotBlank in Java?
isNotBlank() is a static method of the StringUtils class that is used to check if a given string is not blank.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › java › string-handling-with-apache-commons-stringutils-class-in-java
String Handling with Apache Commons' StringUtils Class in Java - GeeksforGeeks
April 28, 2025 - A list of some of the methods available ... of what each method does: isBlank(String str): This method checks if a String is null, empty, or contains only whitespace characters....
🌐
GitHub
github.com › apache › commons-lang › blob › master › src › main › java › org › apache › commons › lang3 › StringUtils.java
commons-lang/src/main/java/org/apache/commons/lang3/StringUtils.java at master · apache/commons-lang
* @param defaultStr the default CharSequence to return if {@code str} is {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}), or · * {@code null}); may be null. * @return the passed in CharSequence, or the default. * @see StringUtils#defaultString(String, String) * @see #isBlank(CharSequence) */ public static <T extends CharSequence> T defaultIfBlank(final T str, final T defaultStr) { return isBlank(str) ?
Author   apache
🌐
Tabnine
tabnine.com › home page › code › java › org.apache.commons.lang3.stringutils
org.apache.commons.lang3.StringUtils.isBlank java code examples | Tabnine
StringUtils.isBlank(null) = true ... = false StringUtils.isBlank(" bob ") = false ... Checks if a CharSequence is not empty (""), not null and not whitespace only. Whitespace is defined ... Checks if a CharSequence is empty ("") or null.
🌐
Apache Commons
commons.apache.org › lang › apidocs › src-html › org › apache › commons › lang3 › StringUtils.html
StringUtils - Source code - The Apache Software Foundation!
1525 * @param defaultStr the default CharSequence to return if {@code str} is {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or 1526 * {@code null}); may be null. 1527 * @return the passed in CharSequence, or the default. 1528 * @see StringUtils#defaultString(String, String) 1529 * @see #isBlank(CharSequence) 1530 */ 1531 public static <T extends CharSequence> T defaultIfBlank(final T str, final T defaultStr) { 1532 return isBlank(str) ?
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-stringutils-isnoneblank-method
Java StringUtils.isNoneBlank() Method with Examples - GeeksforGeeks
October 24, 2023 - The StringUtils.isNoneBlank() function is part of the Apache Commons Lang library, which provides utility methods for working with strings in Java. This function is used to check if multiple strings are not blank or empty.
🌐
Stack Abuse
stackabuse.com › guide-to-apache-commons-stringutils-class-in-java
Guide to Apache Commons' StringUtils Class in Java
September 27, 2023 - Let's start off with some ... any text. Both of these return true if the String is indeed empty. Additionally, isBlank() will also return true if a String contains only whitespaces....
🌐
Kodejava
kodejava.org › how-do-i-check-for-an-empty-string
How do I check for an empty string? - Learn Java by Examples
package org.kodejava.commons.lang; import org.apache.commons.lang3.StringUtils; public class EmptyStringCheckDemo { public static void main(String[] args) { // Create some variable to hold some empty string, contains only // whitespaces and words. String one = ""; String two = "\t\r\n"; String three = " "; String four = null; String five = "four four two"; // We can use StringUtils class for checking if a string is empty or not // using StringUtils.isBlank() method.
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.3 › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.3 API)
IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace ... The StringUtils class defines certain words related to String handling.
🌐
GitHub
github.com › micrometer-metrics › micrometer › issues › 1789
Get rid of StringUtils.isBlank/isNotBlank for just checking empty · Issue #1789 · micrometer-metrics/micrometer
January 12, 2020 - I think it if far easier to just stop using isBlank when all you really need to do is see if something is empty. The current impact is that because we chose to cite apache commons like so... public final class StringUtils { /** * Check if the String is null or has only whitespaces.
Published   Jan 12, 2020
🌐
GitHub
github.com › openrewrite › rewrite-apache › issues › 7
Recipe for replacing StringUtils#isBlank(CharSequence) and StringUtils#isNotBlank(CharSequence) · Issue #7 · openrewrite/rewrite-apache
March 15, 2024 - class A { void foo(String bar) { boolean isBlankBar = StringUtils.isBlank(bar); boolean isNotBlankBar = StringUtils.isNotBlank(bar); } }
Published   Mar 15, 2024