What is moiré and how does it occur?
Moiré is a pattern that occurs when two fine, regularly recurring patterns influence each other. For example, think of two mesh fences that you see one behind the other. When you look from a certain angle, large wavy shapes can sometimes appear that are not present in the individual fences.
Something similar can happen when you take a photo. The sensor of your camera consists of a large number of small light-sensitive points, which are arranged in a regular pattern. When you then photograph a subject with very fine lines, these patterns can influence each other. The result is that your camera sometimes captures lines, waves, or colors that do not actually exist. You can therefore see it as an extra pattern that arises from the combination of the pattern in your subject and that of the sensor in your camera.
By the way, you don't need to fully understand how your sensor causes this to recognize the phenomenon. The important thing is that very fine, repeating details are sometimes not displayed correctly.
When can you encounter these patterns?
The phenomenon mainly occurs with subjects that have many fine lines or repeating shapes. Clothing is perhaps the most well-known example. Think again of fine stripes in a shirt, a checkered coat, or a dress with intricate woven patterns.
But we also see it relatively often in buildings. For example, when you photograph a facade with hundreds of small windows, a fence, or a roof with regularly placed tiles, strange patterns can emerge. Especially when photographing from a greater distance, these details can sometimes become so small that the camera cannot render them properly. In architectural photography it is wise to not only look at your composition but also at fine patterns in the building.
This can also occur when photographing a screen. Because a screen itself consists of many small pixels, unwanted patterns can become visible when you try to capture a screen. Do keep in mind that not every strange line on a screen photo is caused by the same phenomenon. Horizontal bands can also occur because the refresh rate of the screen or the lighting does not sync well with your camera's shutter. That is a different issue.
Why doesn't every photo have this issue?
You might be wondering why you see strange patterns in one photo but not in another. This is due to various factors at play. The size and direction of the pattern are important, as well as the distance to your subject and the characteristics of your camera. Modern cameras often have high-resolution sensors. This allows them to capture more small details. This can reduce the chance of moiré, but it doesn't mean the phenomenon disappears entirely.
Some cameras also have an anti-aliasing filter, also known as an optical low-pass filter. This filter sits in front of the sensor and softens the tiniest details slightly, reducing the likelihood of unwanted patterns.
This may sound strange, as we usually want our photos to be as sharp as possible. However, a little less sharpness can help prevent these patterns. Some camera manufacturers choose to omit this filter to retain more fine details. For manufacturers, it is a trade-off between sharpness and the risk of unwanted patterns.
How can you prevent moiré while photographing?
You definitely don't need to buy a new camera when you experience this. Often, you can reduce the problem by making a small change while photographing. For example, taking a step forward or backward can make a big difference in how the pattern is displayed on your sensor. Sometimes this is enough to make the strange lines disappear.
You can also tilt your camera a bit or photograph from a slightly different angle. This changes the relationship between the lines of your subject and the pattern of the sensor. This can be especially helpful with clothing or buildings that have a lot of fine details.
Are you using a zoom lens? Then try a different focal length. This also changes how large the details in your photo are displayed. Sometimes it can also help to close the aperture a bit. With a very small aperture, the photo becomes somewhat softer due to a phenomenon called diffraction. This means that light spreads a bit at a small aperture, causing fine details to become less sharp. As a result, the unwanted patterns may become less noticeable. The downside is that other details also become less sharp. So this is not always the best solution.
Check your photo carefully after you've taken it. Zoom in on the clothing or the part of the building where you expect fine patterns. These may not always be very noticeable on the small screen of your camera.

Can you remove the patterns during post-processing?
When you only discover strange patterns in your photo at home, fortunately, there is still something you can do. With modern editing programs, you can often reduce unwanted patterns. In Lightroom for example, there is a special setting for moiré. This allows you to try to make strange colors and patterns less visible.
You can use a mask. This allows you to select only the part of the photo where the problem is visible, such as a shirt. You then apply the correction to that part without affecting the rest of the photo. However, keep in mind that not all unwanted patterns can be completely removed. Especially when the patterns are very clearly visible, it can be difficult to recover the original details.
Sometimes you can slightly reduce the color saturation of the affected area. This is especially helpful when strange colors appear, but not when there are clearly wavy lines visible. It is wise to address the problem while photographing, if possible. This saves a lot of work later on.
Patterns can also occur after you have taken the photo
An interesting and annoying detail is that these patterns can arise not only during photography. Sometimes a photo looks perfectly fine at full size, but suddenly strange patterns appear when you make it smaller.
This is because the fine details need to be redistributed over a smaller number of pixels. When this doesn't go well, new patterns can emerge. You may encounter this when you resize a photo for a website or view an image on different screens. It does not automatically mean that there is something wrong with the original file.
Therefore, check your photos not only at full size but also when you have resized them. This is especially important when photographing many patterns, such as fabrics, fences, or buildings. During the editing of your images you can try different export settings and dimensions. Compare the results and see if the patterns become less visible.
Pay special attention to fine patterns
These unwanted patterns can be quite distracting, but fortunately, they do not occur in every photo. When you know which subjects are sensitive to this phenomenon, you can take it into account while photographing. Often, a small change in distance, focal length, or viewpoint is enough to reduce the problem.