# Convert Private Key To Wif Compressed and Uncompressed

```python
from secp256k2 import Contactor

cont = Contactor()

privatekey = "PRIVATE_KEY_HERE"

wif_compress = cont.btc_pvk_to_wif(privatekey, True)

wif_uncompress = cont.btc_pvk_to_wif(privatekey, False)
```

Once you have your private key, you can easily convert it to its Wallet Import Format (WIF) using the `btc_pvk_to_wif` function. This function can generate both compressed and uncompressed WIF formats. The choice between them depends on your specific requirements.

To convert the private key to the compressed WIF format:

```python
wif_compress = cont.btc_pvk_to_wif(privatekey, True)
```

And for the uncompressed WIF format:

```python
wif_uncompress = cont.btc_pvk_to_wif(privatekey, False)
```

The `True` or `False` parameter passed to the function designates whether the resulting WIF should be compressed or uncompressed, respectively. It's crucial to know which format is expected by the services or wallets you plan to use.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.mmdrza.com/guidelines/secp256k2/convert-private-key-to-wif-compressed-and-uncompressed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
