# Modulus Switch in CKKS

**URL:** <https://openfhe.discourse.group/t/modulus-switch-in-ckks/664>\
**Category:** Library Questions\
**Created:** [June 26, 2023, 3:31pm UTC](https://openfhe.discourse.group/t/modulus-switch-in-ckks/664 "2023-06-26T15:31:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntoninaB](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@AntoninaB](https://openfhe.discourse.group/u/AntoninaB)\
**Post date:** [June 26, 2023, 3:31pm UTC](https://openfhe.discourse.group/t/modulus-switch-in-ckks/664/1 "2023-06-26T15:31:20Z")

</div>

Hello,

I want to perform the modulus switch in CKKS. For example, now my modulus Q is the product of two primes: p0 and p1. How can I switch the modulus of the CKKS ciphertext from Q to p0?

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [June 27, 2023, 3:46pm UTC](https://openfhe.discourse.group/t/modulus-switch-in-ckks/664/2 "2023-06-27T15:46:23Z")

</div>

Just use the CryptoContext method `Rescale` ([Template Class CryptoContextImpl — OpenFHE documentation](https://openfhe-development.readthedocs.io/en/latest/api/classlbcrypto_1_1CryptoContextImpl.html?highlight=Rescale#_CPPv4NK8lbcrypto17CryptoContextImpl7RescaleE15ConstCiphertextI7ElementE)) and it will do it for you . Note than all `*AUTO` modes of CKKS do this automatically.

---

<div class="post-metadata">

**Author:** ![AntoninaB](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@AntoninaB](https://openfhe.discourse.group/u/AntoninaB)\
**Post date:** [June 29, 2023, 12:35pm UTC](https://openfhe.discourse.group/t/modulus-switch-in-ckks/664/3 "2023-06-29T12:35:58Z")

</div>

Thank you for the reply. It helps!
