---
title: "Convert Files"
description: "Convert files to different formats."
canonical_url: "https://cloudconvert.com/docs/operations/convert-files"
---
# Convert Files

> Convert files to different formats.

To convert a file to another format, [create a job](https://cloudconvert.com/docs/raw/api-reference/jobs.md#create-job) with a `convert` task.

The available parameters differ based on `input_format` and `output_format`. Select values below to show all available conversion options.

## Task Parameters

### convert task parameters

- `operation` _string_ required: Value is `convert`.
- `input` _string or array of task names_: The input task name(s) for this task.
- `input_format` _string_: The current format of the file, e.g. pdf. If not set, the extension of the input file is used as input format.
- `output_format` _string_ required: The target format to convert to.
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.
- `...` _string_: Conversion specific options depend on the input and output format. Select input and output format above to show additional conversion options.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](https://cloudconvert.com/docs/raw/api-reference/operations.md#list-operations) to identify these dynamic parameters, for example by filtering for `convert` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=convert&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "convert",
            "input": "import-my-file",
            "input_format": "pdf",
            "output_format": "png"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert convert \
    -f png \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "convert",
            "input": "import-my-file",
            "input_format": "pdf",
            "output_format": "png"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('convert', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('input_format', 'pdf')
         ->set('output_format', 'png')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "convert",
            "input": "import-my-file",
            "input_format": "pdf",
            "output_format": "png"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'convert',
            'input': 'import-my-file',
            'input_format': 'pdf',
            'output_format': 'png'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=convert">

Use the **Job Builder** to generate and try out conversion jobs.

</tip>


## Sitemap

See the full [sitemap](https://cloudconvert.com/docs/sitemap.md) for all pages.
