If the field is fixed width storing NULL takes the same space as any other value - the width of the field.

If the field is variable width the NULL value takes up no space.

In addition to the space required to store a null value there is also an overhead for having a nullable column. For each row one bit is used per nullable column to mark whether the value for that column is null or not. This is true whether the column is fixed or variable length.


The reason for the discrepancies that you have observed in information from other sources:

  • The start of the first article is a bit misleading. The article is not talking about the cost of storing a NULL value, but the cost of having the ability to store a NULL (i.e the cost of making a column nullable). It's true that it costs something in storage space to make a column nullable, but once you have done that it takes less space to store a NULL than it takes to store a value (for variable width columns).

  • The second link seems to be a question about Microsoft Access. I don't know the details of how Access stores NULLs but I wouldn't be surprised if it is different to SQL Server.

Answer from Mark Byers on Stack Overflow
🌐
DeviantArt
deviantart.com › xelku9 › art › Pokemon-Size-Chart-Null-and-Silvally-648932239
Pokemon Size Chart: Null and Silvally by Xelku9 on DeviantArt
Pokemon Size Chart: Null and Silvally — artwork by Xelku9 on DeviantArt. Published: 2016-12-01 · Likes: 105 · Views: 9838 · Comments: 23 · Tags: chart, moon, normal, null, pokemon, size, sun, type, xelku, xelku9, pokemonmoon, silvally, 9, pokemonsun, synthetic
🌐
Rules of Acquisition
ditl.org › station-sizecomp.php
Null Space Catapult - Size Chart
Stations Design Lineage Size Charts Battles Science / Tech Temporal Styling Maps / Politics
Top answer
1 of 6
170

If the field is fixed width storing NULL takes the same space as any other value - the width of the field.

If the field is variable width the NULL value takes up no space.

In addition to the space required to store a null value there is also an overhead for having a nullable column. For each row one bit is used per nullable column to mark whether the value for that column is null or not. This is true whether the column is fixed or variable length.


The reason for the discrepancies that you have observed in information from other sources:

  • The start of the first article is a bit misleading. The article is not talking about the cost of storing a NULL value, but the cost of having the ability to store a NULL (i.e the cost of making a column nullable). It's true that it costs something in storage space to make a column nullable, but once you have done that it takes less space to store a NULL than it takes to store a value (for variable width columns).

  • The second link seems to be a question about Microsoft Access. I don't know the details of how Access stores NULLs but I wouldn't be surprised if it is different to SQL Server.

2 of 6
32

The following link claims that if the column is variable length, i.e. varchar then NULL takes 0 bytes (plus 1 byte is used to flag whether value is NULL or not):

  • How does SQL Server really store NULL-s

The above link, as well as the below link, claim that for fixed length columns, i.e. char(10) or int, a value of NULL occupies the length of the column (plus 1 byte to flag whether it's NULL or not):

  • Data Type Performance Tuning Tips for Microsoft SQL Server

Examples:

  1. If you set a char(10) to NULL, it occupies 10 bytes (zeroed out)
  2. An int takes 4 bytes (also zeroed out).
  3. A varchar(1 million) set to NULL takes 0 bytes (+ 2 bytes)

Note: on a slight tangent, the storage size of varchar is the length of data entered + 2 bytes.

🌐
Quora
quora.com › What-is-size-of-null-in-c-language
What is size of null in c language? - Quora
Answer (1 of 4): A good answer from stackOverflow Question - why sizeof(“”) is equivalent to 1 and sizeof(NULL) is equivalent to 4 in c-language? Ans - A string literal is an array of characters* (with static storage), which contains all the characters in the literal along with a terminator.
🌐
Merrell
merrell.com › US › en › content
null | Merrell
Official Merrell site - Shop the full collection of null and find what you're looking for today. Free shipping on all orders!
🌐
Aeropostale
aeropostale.com › size-charts › total-size-charts.html
Girls, Guys & Unisex Clothing Size Charts | Aeropostale
null · All Size Charts Original Version · Shop online in confidence at Aeropostale with help from our various clothing size charts for men and women. Discover more about how our clothing is sized then browse our entire collection of guys’ and girls’ clothing to upgrade your wardrobe.
Top answer
1 of 4
2

Hi @Jan Vávra
Each row has a null bitmap for columns that allow nulls. If the row in that column is null then a bit in the bitmap is 1 else it's 0.
For variable size datatypes the acctual size is 0 bytes.
For fixed size datatype the acctual size is the default datatype size in bytes set to default value (0 for numbers, '' for chars).
In my opinion, uniqueidentifier is a fixed size datatype.
Check this sample:

declare @guid1 uniqueidentifier = null  
       ,@guid2 uniqueidentifier = '728B7419-6E97-4F54-B06B-536B31AE954E'  
	   ,@guid3 uniqueidentifier = '728B7419-6E97-4F54-B06B-536B31AE954E4578RT'  
select DATALENGTH(@guid1)  
      ,DATALENGTH(@guid2)  
	  ,DATALENGTH(@guid3)  

Best regards,
LiHong

2 of 4
1

As Li says, each value will take up 16 bytes, no matter if it's NULL or not. However, there is a twist: if you apply row compression, the NULL values will not take up any bytes beside the bit in the NULL bitmap.

If row compression is not an alternative to you for some reason, varbinary(16) may be a better alternative. I will have to admit that I cannot really decide what I think in this case. I would probably consider the complexity of programming. One thing to keep in mind is that if index these columns and you do:

DECLARE @v uniqueidentifier  
...  
SELECT ... FROM tbl WHERE indexedbincol = @v  

The rules of type precedence in SQL Server will convert the binary column to uniqueidentifier, which most likely will prevent an Index Seek. (I have not actually tested to verify.) So if you go for varbinary(16), you should so throughout your application.

Viorel is perfectly right in that varchar(32) is not an alternative.

🌐
DiKnows Tech
diknowstech.wordpress.com › 2009 › 12 › 21 › what-is-the-size-of-null-operator-in-java
What is the Size of ” null ” Operator in Java? | DiKnows Tech
January 2, 2010 - from the heap memory perspective it will be 0, as it wont allocate any memory from heap. But from stack memory perspective the object has reference which is set to null. and the reference variable size depends your system.
Top answer
1 of 5
21

A string literal is an array of characters* (with static storage), which contains all the characters in the literal along with a terminator. The size of an array is the size of the element multiplied by the number of elements in the array.

The literal "" is an array that consists of one char with the value 0. The type is char[1], and sizeof(char) is always one; thereforesizeof(char[1]) is always one.

In C, NULL is implementation-defined, and is often ((void*)0). The size of a void*, on your particular implementation, is 4. It may be a different number depending on the platform you run on. NULL may also expand to an integer of some type of the value 0, and you'd get the size of that instead.

*A literal is not a pointer, arrays are not pointers, pointers do not play a role in this part of the question.

2 of 5
15

The empty string "" has type char[1], or "array 1 of char". It is not a pointer, as most people believe. It can decay into a pointer, so any time a pointer to char is expected, you can use an array of char instead, and the array will decay into a pointer to its first element.

Since sizeof(char) is 1 (by definition), we therefore have sizeof("") is sizeof(char[1]), which is 1*1 = 1.

In C, NULL is an "implementation-defined null pointer constant" (C99 §7.17.3). A "null pointer constant" is defined to be an integer expression with the value 0, or such an expression cast to type void * (C99 §6.3.2.3.3). So the actual value of sizeof(NULL) is implementation-defined: you might get sizeof(int), or you might get sizeof(void*). On 64-bit systems, you often have sizeof(int) == 4 and sizeof(void*) == 8, which means you can't depend on what sizeof(NULL) is.

Also note that most C implementations define NULL as ((void*)0) (though this is not required by the standard), whereas most C++ implementations just define NULL as a plain 0. This means that the value of sizeof(NULL) can and will change depending on if code is compiled as C or as C++ (for example, code in header files shared between C and C++ source files). So do not depend on sizeof(NULL).

Find elsewhere
🌐
Aeropostale
aeropostale.com › size-charts › womens-size-chart.html
Women's Size Chart: Pants, Jeans, Skirts, Dresses & Tops | Aeropostale
null · 2023 - Women's Size Chart · With the help of our women’s sizing guides and recommendations, finding clothing styles that compliment your body or fit your aesthetic has never been easier.
🌐
Quora
quora.com › What-is-the-size-of-a-null-string
What is the size of a null string? - Quora
Answer (1 of 4): It depends on what a “NULL string” means in various languages. * In a language like C, you can have a char pointer that is set to NULL. In this case, the “string part” isn’t represented, and the only space used is the space for the char pointer itself.
🌐
Pinterest
pinterest.com › explore
Blank Size Chart
Discover Pinterest’s best ideas and inspiration for Blank size chart.
🌐
Theory
theory.com › uk-size-guide.html
null | Theory
ESSENTIAL DUOS AND TRIOS *Choose 2 or 3 of the same marked style in any size or color to receive an additional discount. Applicable styles will be marked. Discount will be auto-applied at checkout. Offer valid in Theory retail stores and online at theory.com in select countries.
🌐
Infragistics
infragistics.com › help › winforms › chart-customize-the-display-of-null-values
Customize the Display of Null Values - Infragistics Windows Forms™ Help
Starting with a InterpolateSimple line chart, the Data.EmptyStyle.EnablePoint property is set to True. The result is that a symbol is drawn to indicate which values are null on the chart. By default, this symbol is an "X".
🌐
Canva
canva.com › home › templates › size chart
Free and customizable size chart templates
Browse our free templates for size chart designs you can easily customize and share.
🌐
Wikipedia
en.wikipedia.org › wiki › Size_zero
Size zero - Wikipedia
April 10, 2026 - For example, a 2011 size 0 is ... the time. Modern size 0 clothing, depending on brand and style, fits measurements of chest-stomach-hips from 30-22-32 inches (76-56-81 cm) to 33-25-35 inches (84-64-89 cm)....
🌐
Quora
quora.com › What-is-the-difference-between-being-null-or-having-a-size-of-zero-in-a-list
What is the difference between being null or having a size of zero in a list? - Quora
Answer (1 of 37): I'll assume this is Java, but the answer should be about the same in any case. For that example, you will get the same behavior, because that method guards against nulls. But in other cases, there is a difference between a null and an empty list. The most notable is that if y...
🌐
Talbots
talbots.com › size-charts
Size Charts | Talbots
Use the Talbots Size Chart to find your perfect fit! See sizing for all of our concepts, including misses, petite, plus size & plus size petites.