UPDATED 7/18/2023: On Windows 11, “SMB compression” is a feature designed to request file compression during a transfer over the network. This feature aims to make file transfers faster and reduce bandwidth for large files without having to compress files at the source and then decompress the contents at the destination.
Typically, you would notice the benefit of SMB compression on networks with less bandwidth. For example, on computers with 1Gbps Ethernet or Wi-Fi adapters. On the other hand, if you have, for example, two servers with 100Gbps network adapters with solid-state drives (SSDs), you may not benefit from SMB compression. In practice, it may even take more time.
Compression with SMB on Windows 11 supports algorithms XPRESS (LZ77), XPRESS Huffman (LZ77+Huffman), LZNT1, or PATTERN_V1*. XPRESS is used automatically, SMB signing and SMB encryption, SMB signing and SMB encryption, and SMB Multichannel, but it doesn’t support SMB Direct over RDMA.
In this guide, you will learn how to configure SMB compression to make file transfers faster between computers and servers in the network.
- Configure SMB compression for mapped drives (client) on Windows 11
- Configure SMB compression for mapped drives (server) on Windows 11
- Configure SMB compression for Robocopy on Windows 11
- Configure SMB compression for Xcopy on Windows 11
Configure SMB compression for mapped drives (client) on Windows 11
You can configure SMB compression from the device acting as a client or server. The steps below are meant to configure a client computer to request compression for a network folder mapped to Windows 11.
1. Request compression from Command Prompt
To map a shared folder requesting SMB compression with Command Prompt:
-
Open Start on Windows 11.
-
Search for Command Prompt, and click the top result to open the app.
-
Type the following command to map a network folder requesting compression and press Enter:
net use * \\file-server\share-folder /requestcompression:yes
In the command, specify the path to the network folder you want to mount. The asterisk (*) assigns the drive letter automatically, but you can change it to anything you want.
Once you complete the steps, as you transfer files to the network folder, Windows 11 will try to compress the contents to speed up the transfer.
2. Request compression from PowerShell
To map a shared folder requesting compression with PowerShell commands:
-
Open Start.
-
Search for PowerShell, and click the top result to open the app
-
Type the following command to map a network folder requesting compression and press Enter:
New-SmbMapping -LocalPath "Z:" -RemotePath "\\file-server\share-folder" -CompressNetworkTraffic $true
In the command, update “Z:” for the drive letter, specify the path to the network folder to mount, and enable compression.
After you complete the steps, compression will occur to speed up the transfer of files. The file share will mount when you use this method, but it may not appear in File Explorer.
Configure SMB compression for mapped drives (server) on Windows 11
It’s also possible to create a file share with SMB compression turned on so that client devices can take advantage of the improved file transfers without configuring every device, only the server.
1. Create new share with compression
To create a network folder with SMB compression, use these steps:
-
Open Start.
-
Search for PowerShell, right-click the top result, and select the Run as administrator option.
-
Type the following command to create a folder to share in the network and press Enter:
New-Item -Path "c:\" -Name "folder-name" -ItemType "directory"
-
Type the following command to create a new file share folder with SMB compression and press Enter:
New-SmbShare -Name "file-share-name" -Path "C:\file-share-name" -CompressData $true
In the command, update the name of the share and path with your information.
Once you complete the steps, computers in the network can transfer files at higher speeds using compression without additional configuration from the client side.
2. Edit existing share with compression
To enable SMB compression on existing shared folders on a server:
-
Open Start.
-
Search for PowerShell, right-click the top result, and select the Run as administrator option.
-
Type the following command to configure a shared folder to request compression and press Enter:
Set-SmbShare -Name "file-share-name" -CompressData $true
In the command, remember to specify the name of the existing file share you have to update.
- Type “Y” and press Enter to continue.
After you complete the steps, the existing shared folder will enable SMB compression.
Configure SMB compression for Robocopy on Windows 11
To use compression when copying files with Robocopy, use these steps:
-
Open Start.
-
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
-
Type the following command to copy files over the network with SMB compression and press Enter:
robocopy c:\source\path\folder \\destination\path\folder /compress
In the command, specify the source and destination paths for the paths in your environment.
Once you complete the steps, copying files from the source to the destination should be noticeably faster, thanks to SMB compression.
Configure SMB compression for Xcopy on Windows 11
To use SMB compression when copying files with Xcopy, use these steps:
-
Open Start.
-
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
-
Type the following command to copy files over the network with SMB compression and press Enter:
xcopy c:\source\path\folder \\destination\path\folder /compress
In the command, specify the source and destination paths for the paths in your environment.
After you complete the steps, file transfer between the source and destination will be much faster due to compression, making the files smaller during the operation.
SMB compression is available on Windows 11 and Windows Server 2022. Also, by default, the algorithm will attempt to compress the 500MiB of a file and monitor the first 100MiB of the starting amount. If less than 100MiB is compressible, the compression will stop, and the transfer will continue without further compression. However, Microsoft is tweaking the algorithm for the next update of Windows 11 so that the feature will always attempt to compress when the compression is requested.