Office Compressor
Compress Microsoft Office documents (Word and PowerPoint) to reduce file size. Optimizes embedded images and media within the document.
Try Word compression in the browser →
Compress.FAST uses this same API — what you see in the browser is what you get in code.
Quick reference
| Job type | document.office-compress |
| Category | documents |
| Endpoint | POST /compress/office |
| Input formats | .docx, .pptx |
| Output format | same as input |
| Costing | 1 credit per 5 MB |
| Max file size | 1 GB |
| Options | resize |
Example
# compress a PowerPoint presentation
JOB_ID=$(curl -sS -X POST "https://api.tools.fast/compress" \
-H "X-Fast-Api-Key: $API_KEY" \
-F "file=@presentation.pptx" | jq -r '.id')
# poll until complete
while true; do
STATUS=$(curl -sS "https://api.tools.fast/compress/job/${JOB_ID}" \
-H "X-Fast-Api-Key: $API_KEY" | jq -r '.status')
[ "${STATUS}" = "Succeeded" ] && break
[ "${STATUS}" = "Failed" ] || [ "${STATUS}" = "Canceled" ] && exit 1
sleep 1
done
# download
curl -sS "https://api.tools.fast/compress/job/${JOB_ID}/download" \
-H "X-Fast-Api-Key: $API_KEY" \
-o "presentation-compressed.pptx"using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-Fast-Api-Key", "fast_prod_your_key_here");
using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("presentation.pptx")),
"file", "presentation.pptx");
var submit = await http.PostAsync("https://api.tools.fast/compress", form);
var job = await submit.Content.ReadFromJsonAsync<JsonElement>();
var jobId = job.GetProperty("id").GetString();
string status;
do
{
await Task.Delay(1000);
var poll = await http.GetFromJsonAsync<JsonElement>(
$"https://api.tools.fast/compress/job/{jobId}");
status = poll.GetProperty("status").GetString()!;
} while (status is "Queued" or "Running");
var output = await http.GetByteArrayAsync(
$"https://api.tools.fast/compress/job/{jobId}/download");
File.WriteAllBytes("presentation-compressed.pptx", output);$headers = @{ "X-Fast-Api-Key" = "fast_prod_your_key_here" }
# compress a PowerPoint presentation
$job = Invoke-RestMethod -Method Post "https://api.tools.fast/compress" `
-Headers $headers `
-Form @{ file = Get-Item "presentation.pptx" }
# poll until complete
do {
$status = (Invoke-RestMethod "https://api.tools.fast/compress/job/$($job.id)" `
-Headers $headers).status
if ($status -in "Failed", "Canceled") { throw "Job $($job.id) $status" }
Start-Sleep -Seconds 1
} while ($status -ne "Succeeded")
# download
Invoke-RestMethod "https://api.tools.fast/compress/job/$($job.id)/download" `
-Headers $headers -OutFile "presentation-compressed.pptx"Options
The Office compressor supports resize -- scale down embedded images within the document while preserving page layout and dimensions. This is the same resize option used by image compressors, but applied to images inside the Office file rather than the file itself. See Options for the full resize reference.
Note: Resize is available for Word (
.docx) and PowerPoint (.pptx). The PDF compressor does not support resize.
# compress + resize embedded images to 1080p
curl -sS -X POST "https://api.tools.fast/compress" \
-H "X-Fast-Api-Key: $API_KEY" \
-F "file=@presentation.pptx" \
-F 'options={"_schemaVersion":1,"resize":{"enabled":true,"preset":"1080p","mode":"pixels","value":null}}'using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("presentation.pptx")),
"file", "presentation.pptx");
form.Add(new StringContent(
"""{"_schemaVersion":1,"resize":{"enabled":true,"preset":"1080p","mode":"pixels","value":null}}"""),
"options");
var response = await http.PostAsync("https://api.tools.fast/compress", form);Invoke-RestMethod -Method Post "https://api.tools.fast/compress" `
-Headers @{ "X-Fast-Api-Key" = $Key } `
-Form @{
file = Get-Item "presentation.pptx"
options = '{"_schemaVersion":1,"resize":{"enabled":true,"preset":"1080p","mode":"pixels","value":null}}'
}Notes
- The output format matches the input format -- a
.docxinput produces a.docxoutput. - Embedded images within the document are recompressed to reduce file size.
- Document formatting, styles, and layout are preserved.
- PowerPoint presentations with many high-resolution images typically see the largest compression ratios.
- Only
.docxand.pptxformats are supported. Legacy.docand.pptformats are not accepted.