I really enjoying learning 成语 (chéng yǔ) in Chinese, and I'm curious to know why they are often or always four characters long? Where does this tradition stem from?
And are there 成语 with more or less than four characters?
Taken from my.chinese.cn:
Why are idioms mostly four characters? This is basically because four words are catchy. Our country's famous book of poetry, 《诗经》, mostly uses four-character sentences, and the historical book 《尚书》 also has many four-character sentences. Then there are the (三、百、千) 《三字经》《百家姓》《千字文》, the latter two of which use four-character sentences. 《四言杂字》《龙文鞭影》 1st, 2nd and 3rd collections all have four words. Although these are books for educating small children they also illustrate people's enjoyment of four-character sentences.
You can find some examples of longer idioms at Wikiquote:
Tiān gaō huáng dì yuǎn.
"The sky is high and the emperor is far away" — used as in carefree (lawlessness).
Zì zhù zhě tiān zhù
Literally: Those who help themselves, God will help. Meaning: God will help those who help themselves.
You can find some 3 character idioms (in Chinese) at chengyu.itlearner.com.
I agree with the viewpoints from xiaohouzi79, and I would like to make a supplement here.
Many idioms come from classic poems and books，and as xiaohouzi79 mentioned, four-character sentences were popular in these materials, especially I think in poems and books(such 《诗经》,《左传》,etc.) before Qin Dynast(221BC-207BC).Although foreigner may be more familiar with 唐诗(poems written in Tang Dynasty(618 AD-907 AD)),in which one sentence usually consists of 5 or 7 characters, before 晋 dynasty(266 AD-420 AD), it was popular to write a poem with sentences consisting four characters. I believe that because of the popularity of four-character sentence, people in later times would compact a sentence into a four-character sentence to be an idiom, as the four-character sentence became the standard de facto for idioms.
I would like to show you some idioms and their originations, and I strongly suggest you consult them in a dictionary if you are interested, for my English level prevents me from giving you good explanations. Of course, I will try to explain some :). Note:"原文" means "the original text" below.
风雨如晦 原文：风雨如晦, 鸡鸣不已。from the book of《诗经》
literally meaning: It looks like in a night because of the heavy wind and rain.In fact, it's an analogy that the society or the country is in a darkness or turmoil.
老骥伏枥 原文：老骥伏枥，志在千里。from the poem of《步出夏门行·龟虽寿》 by famous politician, militarist and writer 曹操)
literally meaning: An old good horse stays near the trough, while it still wishes to show its power outside. It's an analogy to describe an old hero still with aspirations.
其乐融融 原文：大隧之中，其乐 也 融融。from the book of《左传》
literally meaning: very happy. It's offen used to decribe the happiness of a family.
大义灭亲 原文：大义灭亲，其是之谓乎？from the book of《左传》
literally meaning: Kill one's relatives(in the original text, his son), in order to ensure justice. It's used to describe someone injures someone else's interest, for the sake of justice or morality, although he is a relative (or a family member, or a close friend) of yours.
扑朔迷离 原文：雄兔脚 扑朔，雌兔眼 迷离。双兔傍地走，安能辨我是雄雌？ from the poem of《木兰诗》.
I think you would have seen the film of "Mulan" from Hollywood, which is adapted from this poem. The original text is difficult for me to translate...
人言可畏 原文：仲可怀也，人 之多 言，亦 可畏 也。from the book of《诗经》
meaning: the gossip or rumor from other people is really fearful.
缘木求鱼 原文：犹 缘木 而 求鱼 也。 from the book of《孟子》
literally meaning: Climb up a tree to find fish. It's an analogy to say that someone is doing something in a wrong(impossible) way.
游刃有余 原文：恢恢乎其于 游刃 必 有余 地矣。from the book of《庄子》
literally meaning: there must be some gaps to accommodate the moving knife(in the original context, the writer is surprised to see that a butcher is so skillful to dismember a cattle that his knife moves freely in the cattle's body). It's an analogy to say someone is very proficient in doing something.
Ther are very few idioms consisting of more characters or less.
With one leaf at front of your eyes, you can't see Mountain Tai. An analogy to say that someone is not able to have a long-term sight, to think about the future.
多行不义必自毙 from 《左传》
(someone) will certainly get the punishment he deserves from the god, after he committed so many bad things.
冒天下之大不韪 its prototype is from《左传》
To risk universal condemnation. To commit something wrong that all other people would not do.
莫须有 from the historical book of 《宋史》
literally meaning: not must have(in the original context, it means:"[I] don't have to have[any piece of evidence to show his guilty]". This comes from a famous story related to the famous General 岳飞. Today, we use it to say something that is not true, that is fabricated.
想当然 原文：以今度之，想当然 耳。 from the historical book of 《后汉书》
In the original context, it means [by comparsing the current situation with that one, I] think it should be so(in the original context, the speaker 孔融 used this word to show his criticisms and sarcasms to 曹操).Now it is used to say someone assumes something without a strong foundation.
At last, I want to say that I think idioms are derived from classic Chinese(but it seems that there is no offical standard to determine if a 4-character word is an idiom, of course an authoritative dectionary would give an answer), so some fixed words popular in oral speaking are not idioms(the words listed in the link given by xiaohouzi79), in my opinion, because of lackage of cultural heritages.
As stated in this document about four-syllables idioms, "Four-character idioms are fixed usage, four syllables in length, which convey simply and succinctly a certain meaning. That meaning can be a description of a person, object, or state of affairs, or some piece of wisdom about the world. There are other forms of idioms apart from the four-syllable type; the Chinese language, however, tends naturally to form words and phrases into twos — so much that it has been called an "even number" language — and it particularly favors two- and four-syllable constructions. For this reason, four-syllable idioms are far and away the most numerous type. [...]"
Bold parts are mine since they refer to your question.