# BFV Plaintext Modulus

**URL:** <https://openfhe.discourse.group/t/bfv-plaintext-modulus/2315>\
**Category:** Library Questions\
**Tags:** openfhe-help\
**Created:** [April 24, 2026, 8:44am UTC](https://openfhe.discourse.group/t/bfv-plaintext-modulus/2315 "2026-04-24T08:44:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fishr](https://avatars.discourse-cdn.com/v4/letter/f/ad7895/32.png) [@fishr](https://openfhe.discourse.group/u/fishr)\
**Post date:** [April 24, 2026, 8:44am UTC](https://openfhe.discourse.group/t/bfv-plaintext-modulus/2315/1 "2026-04-24T08:44:00Z")

</div>

Hello everyone,

I’m currently struggling with understanding why my ciphertexts are not decrypting correctly.  
The library API does not report any errors. Here is the minimal example:

```cpp
#include <openfhe.h>

using namespace lbcrypto;
using namespace std;

#include <iostream>

int main(int argc, char *argv[]) {
  CCParams<CryptoContextBFVRNS> parameters;
  parameters.SetPlaintextModulus(1536369893834753); // prob has to do with this pmod, 51 bit
  parameters.SetRingDim(65536); // log2 16
  parameters.SetMultiplicativeDepth(2);

  const auto cc = GenCryptoContext(parameters);
  cc->Enable(PKE);

  const auto keys = cc->KeyGen();
  const auto pt = cc->MakePackedPlaintext({1, 2, 3, 4, 5, 6, 7, 8, 9});
  const auto ct = cc->Encrypt(keys.publicKey, pt);

  Plaintext pt_dc;
  cc->Decrypt(keys.secretKey, ct, &pt_dc);

  std::cout << "plain = " << pt_dc << std::endl;
}

```

When running this program it prints out a bunch of noise, whereas I would expect to see the output `plain = (1, 2, 3, 4, 5, 6, 7, 8, 9, … )`.  
Running the same program with a smaller plaintext modulus (e.g. with `FirstPrime(50, 131072)`) does work as excepted.

Is this related to the plaintext limitation of the library, i.e. bigger plaintext modulus not working?  
There was a similar question [Big plaintext moduli](https://openfhe.discourse.group/t/big-plaintext-moduli/1739), which mentioned approx 60 bit as a limit for the modulus. Could it be as low as 51 bit, maybe even related to the ring dimension, or am I missing something?

tested on v1.5.1, MATHBACKEND 4, NATIVE\_SIZE 64, WITH\_OPENMP OFF, WITH\_NATIVEOPT ON.

---

<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:** [April 29, 2026, 6:45pm UTC](https://openfhe.discourse.group/t/bfv-plaintext-modulus/2315/2 "2026-04-29T18:45:54Z")

</div>

Yes, the actual limit for plaintext moduli is lower than 60 bits. In the unit tests for BFV we check up to 46-bit moduli (see the PR at [Added unit tests for larger plaintext moduli in BFV by yspolyakov · Pull Request #880 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/pull/880) for more details). In general, we do not recommend using larger plaintext moduli because the noise for each multiplicative level is proportional to the plaintext modulus size. A plaintext CRT is suggested instead.
